var a = document . getelementsbyname(" num ")。價值;
在select中編寫onchange方法
& ltselect name = " num " onchange = " jsfs()" & gt;
& ltoption selected = " selected " & gt1 & lt;/option & gt;
& lt選項& gt2 & lt/option & gt;
& lt選項& gt3 & lt/option & gt;
& lt/select & gt;
然後在js中添加jsfs()方法。
& ltscript type = " text/JavaScript " & gt;
函數jsfs()
{
var a = document . getelementsbyname(" num ")。價值;
var b = document . getelementsbyname(" score _ one ")。價值;
document . getelementsbyname(" score _ all ")。值= a * b;
}
& lt/script & gt;