3个input,前两个是数据输入框一样,最后的input是前两个input数据相加的显示结果,
要求是前面的两个input的数据和动态输出到第三个input
---------------------------------------------------------------
1<input id="i1" onpropertychange="c()"/>
1<input id="i2" onpropertychange="c()"/>
1<input id="i3"/>
1<script>
2function c(){
3with(document.all){
4i3.value=Number(i1.value)+Number(i2.value)
5}
6}
7</script>
---------------------------------------------------------------
1<input id="t1" onpropertychange="t1change()"/>
1<input id="t2" onpropertychange="t2change()"/>
1<input id="t3"/>
1<script>
2function t1change(){
3if (!t2.value) t3.value=t1.value
4}
5
6function t2change(){
7t3.value=t1.value*1+t2.value*1
8}
9</script>
---------------------------------------------------------------
1<form name="form1">
2<input name="txt1" ondragenter="return false" onkeypress="return event.keyCode>=48&&event.keyCode<=57 ¦ ¦event.keyCode==46" onpaste="return !clipboardData.getData('text').match(/\D/)" onpropertychange="jia()" style="ime-mode:Disabled"/><br/>
3<input name="txt2" ondragenter="return false" onkeypress="return event.keyCode>=48&&event.keyCode<=57 ¦ ¦event.keyCode==46" onpaste="return !clipboardData.getData('text').match(/\D/)" onpropertychange="jia()" style="ime-mode:Disabled"/><br/>
4<input name="txt3" readonly=""/>
5</form>
1<script language="javascript">
2function jia()
3{
4var n1 = document.form1.txt1.value;
5var n2 = document.form1.txt2.value;
6document.form1.txt3.value = parseFloat(n1) + parseFloat(n2);
7}
8</script>