整数相加

苹果:<INPUTonpropertychange=ch()value="3.0"type=textname=a>数量:<INPUTonpropertychange=ch()value="2"type=textname=c><br>

香蕉:<INPUTonpropertychange=ch()value="2.0"type=textname=b>数量:<INPUTonpropertychange=ch()value="2"type=textname=d><br>

总价:<INPUTvalue="0"type=textname=e>

<scriptlanguage="JavaScript">

ch();

functionch(name)

{

document.getElementsByTagName("input").e.value=parseInt(document.getElementsByTagName("input").a.value)*parseInt(document.getElementsByTagName("input").c.value)+parseInt(document.getElementsByTagName("input").b.value)*parseInt(document.getElementsByTagName("input").d.value)

}

</script>

相关推荐