怎样使用js计算DropDownList的两个数值相加..
function form1_onsubmit()
{
var dr3=document( "DropDownList3 ").value;
var dr4=document( "DropDownList4 ").value;
if((int)dr3+(int)dr4!=10)
{
alert( "属性设置不正确 ");
retun false;
}
---------------------------------------------
应该怎么改才能完成计算并判断计算结果是否为10.帮我看看吧?
------解决方案--------------------function form1_onsubmit()
{
var dr3=document( "DropDownList3 ").value;
var dr4=document( "DropDownList4 ").value;
if(parseInt(dr3)+parseInt(dr4)!=10)
{
alert( "属性设置不正确 ");
retun false;
}
------解决方案--------------------parseFloat(eval(document( "DropDownList3 ").value))
------解决方案--------------------function form1_onsubmit()
{
var dr3 = document.getElementById( "DropDownList3 ").value;
var dr4 = document.getElementById( "DropDownList4 ").value;
if((parseInt(dr3) + parseInt(dr4))!= 10)
{
alert( "属性设置不正确 ");
return false;
}
}