The html:
<html>
<title>A demo showing html UI reacting in real time.</title>
<body>
<form name=f1 action=aa type=get>
<table >
<tr><td>
Number 1</td> <td><input id=t1 onChange=t1c()></td>
<title>A demo showing html UI reacting in real time.</title>
<body>
<form name=f1 action=aa type=get>
<table >
<tr><td>
Number 1</td> <td><input id=t1 onChange=t1c()></td>
</tr>
<tr><td>
Number 2</td> <td><input id=t2 onChange=t1c()></td>
</tr>
<tr id=oprw><td>
Operation</td> <td><select id=op onChange=t1c()>
<option value=a>+<option>
<option value=s>-<option>
<option value=m>*<option>
<option value=d>/<option>
</select></td>
</tr>
<tr><td>
Result</td> <td><input id=r disabled=true></td>
Result</td> <td><input id=r disabled=true></td>
</tr>
<tr>
<tr>
<td><input id=d1 onChange=d1c()></td>
</table>
</form>.
<script>
</table>
</form>.
<script>
function t1c(){
//alert("t1c");
var op = document.getElementById("op");
var t1 = document.getElementById("t1");
var t2 = document.getElementById("t2");
var oprw = document.getElementById("oprw");
if(isNaN(t2.value))return;
var r = document.getElementById("r");
alert("t1c " + t1.value + " t2 " + t2.value + " op " + op.value
+ " Number( t1.value) "+ Number( t1.value)
+ " Number( t2.value) "+ Number( t2.value));
r.disabled = false;
switch (op.value){
case 'a':
alert ("add" + (Number( t1.value) + Number( t2.value)))
//r.value = Math.parseDouble(t1.value) + Math.parseDouble(t2.value);
r.value = String (Number( t1.value) + Number( t2.value));
break;
case 's':
//r.value = Math.parseDouble(t1.value) + Math.parseDouble(t2.value);
r.value = (1 * t1.value) - (1 * t2.value);
break;
case 'm':
//r.value = Math.parseDouble(t1.value) + Math.parseDouble(t2.value);
r.value = (1 * t1.value) * (1 * t2.value);
break;
//alert("t1c");
var op = document.getElementById("op");
var t1 = document.getElementById("t1");
var t2 = document.getElementById("t2");
var oprw = document.getElementById("oprw");
if(isNaN(t2.value))return;
var r = document.getElementById("r");
alert("t1c " + t1.value + " t2 " + t2.value + " op " + op.value
+ " Number( t1.value) "+ Number( t1.value)
+ " Number( t2.value) "+ Number( t2.value));
r.disabled = false;
switch (op.value){
case 'a':
alert ("add" + (Number( t1.value) + Number( t2.value)))
//r.value = Math.parseDouble(t1.value) + Math.parseDouble(t2.value);
r.value = String (Number( t1.value) + Number( t2.value));
break;
case 's':
//r.value = Math.parseDouble(t1.value) + Math.parseDouble(t2.value);
r.value = (1 * t1.value) - (1 * t2.value);
break;
case 'm':
//r.value = Math.parseDouble(t1.value) + Math.parseDouble(t2.value);
r.value = (1 * t1.value) * (1 * t2.value);
break;
case 'd':
//r.value = Math.parseDouble(t1.value) + Math.parseDouble(t2.value);
r.value = (1 * t1.value) / (1 * t2.value);
break;
//r.value = Math.parseDouble(t1.value) + Math.parseDouble(t2.value);
r.value = (1 * t1.value) / (1 * t2.value);
break;
}
r.disabled = true ;
}
</script>
r.disabled = true ;
}
</script>
</body>
</html>
Same but not escaped:
. ;
Regards
Tushar Kapila
http://sel2in.com
Java, PHP, VB6 Apps. Fight Back pain: Exercise timer application
http://ksoft7.tripod.com/g3.html search page that allows you to search within any website uses google works best in Internet explorer and opera
http://minutes-alarm.sourceforge.net freeware minute alarm, easy reminder for back ache - stand up or meeting ...
Volunteer computer Cancer cures www.worldcommunitygrid.org
Click: www.thehungersite.com , and www.bhookh.com feed hungry , its free. www.ecologyfund.com
Physics-particle research & you helping http://stephenbrooks.org/muon1
Please add these to your start-up how to: http://tusharkapila.blogspot.com/2008/05/s.html
No comments:
Post a Comment