asp调用JS函数,将ASP中的变量做为参数传递给JS函数
<SCRIPTLANGUAGE="JavaScript"><!--functionchangeCheck(){varbb=document.getElementById(...
<SCRIPT LANGUAGE="JavaScript">
<!--
function changeCheck()
{
var bb=document.getElementById("bbb");
var cc=document.getElementById("ccc");
var a=document.all.aaa.value;
var b=document.all.bbb.value;
var total1=document.all.hhh.value;
if(cc.checked){
bb.readonly=true;
bb.disabled = true;
total1=parseInt(total1)+parseInt(a*b/50);
document.all.hhh.value=total1;
}
else
{
bb.readonly=false;
bb.disabled = false;
total1=total1-a*b/50;
document.all.hhh.value=total1;
}
document.all.total1.innerHTML="<font color=red size=4>"+total1+"</font>";
}
//-->
<!--
function changeCheck1()
{
var bb=document.getElementById("bbb1");
var cc=document.getElementById("ccc1");
var a=document.all.aaa1.value;
var b=document.all.bbb1.value;
var total1=document.all.hhh.value;
if(cc.checked){
bb.readonly=true;
bb.disabled = true;
total1=parseInt(total1)+parseInt(a*b/50);
document.all.hhh.value=total1;
}
else
{
bb.readonly=false;
bb.disabled = false;
total1=total1-a*b/50;
document.all.hhh.value=total1;
}
document.all.total1.innerHTML="<font color=red size=4>"+total1+"</font>";
}
//-->
</SCRIPT>
<html>
<head></head>
<body>
<input id="aaa" name="aaa" type="text" style="width:50px" size=106 value="50" readonly="1">
密码:<input id="bbb" type="text" name="bbb" size=106 style="width:50px" value="90">
<input name="ccc" type="checkbox")" value="checkbox" onClick="changeCheck();"> <br>
<input id="aaa1" name="aaa1" type="text" style="width:50px" size=106 value="50" readonly="1">
密码:<input id="bbb1" type="text" name="bbb1" size=106 style="width:50px" value="90">
<input name="ccc1" type="checkbox")" value="checkbox" onClick="changeCheck1();"><br>
<input name="hhh" type="hidden" value="0">
<span id="total1"></span>
</body>
</html>
我想把上面的两个函数整合成一个,但是总是出错,请高手指教,谢谢
在线等候中,各位大虾,满意的我再加50,谢谢了 展开
<!--
function changeCheck()
{
var bb=document.getElementById("bbb");
var cc=document.getElementById("ccc");
var a=document.all.aaa.value;
var b=document.all.bbb.value;
var total1=document.all.hhh.value;
if(cc.checked){
bb.readonly=true;
bb.disabled = true;
total1=parseInt(total1)+parseInt(a*b/50);
document.all.hhh.value=total1;
}
else
{
bb.readonly=false;
bb.disabled = false;
total1=total1-a*b/50;
document.all.hhh.value=total1;
}
document.all.total1.innerHTML="<font color=red size=4>"+total1+"</font>";
}
//-->
<!--
function changeCheck1()
{
var bb=document.getElementById("bbb1");
var cc=document.getElementById("ccc1");
var a=document.all.aaa1.value;
var b=document.all.bbb1.value;
var total1=document.all.hhh.value;
if(cc.checked){
bb.readonly=true;
bb.disabled = true;
total1=parseInt(total1)+parseInt(a*b/50);
document.all.hhh.value=total1;
}
else
{
bb.readonly=false;
bb.disabled = false;
total1=total1-a*b/50;
document.all.hhh.value=total1;
}
document.all.total1.innerHTML="<font color=red size=4>"+total1+"</font>";
}
//-->
</SCRIPT>
<html>
<head></head>
<body>
<input id="aaa" name="aaa" type="text" style="width:50px" size=106 value="50" readonly="1">
密码:<input id="bbb" type="text" name="bbb" size=106 style="width:50px" value="90">
<input name="ccc" type="checkbox")" value="checkbox" onClick="changeCheck();"> <br>
<input id="aaa1" name="aaa1" type="text" style="width:50px" size=106 value="50" readonly="1">
密码:<input id="bbb1" type="text" name="bbb1" size=106 style="width:50px" value="90">
<input name="ccc1" type="checkbox")" value="checkbox" onClick="changeCheck1();"><br>
<input name="hhh" type="hidden" value="0">
<span id="total1"></span>
</body>
</html>
我想把上面的两个函数整合成一个,但是总是出错,请高手指教,谢谢
在线等候中,各位大虾,满意的我再加50,谢谢了 展开
1个回答
展开全部
改好了
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<SCRIPT LANGUAGE="JavaScript">
<!--
function changeCheck(v)
{
var aa=eval("aaa"+v);
var bb=eval("bbb"+v);
var cc=eval("ccc"+v);
var tt=eval("hhh"+v);
var oSpan=eval("total"+v);
var a=aa.value;
var b=bb.value;
var total=tt.value;
if(cc.checked){
bb.readonly=true;
bb.disabled = true;
total=parseInt(total)+parseInt(a*b/50);
tt.value=total;
}
else{
bb.readonly=false;
bb.disabled = false;
total=total-a*b/50;
tt.value=total;
}
oSpan.innerHTML="<font color=red size=4>"+total+"</font>";
}
//-->
</SCRIPT>
</head>
<body>
<input id="aaa0" name="aaa0" type="text" style="width:50px" size=106 value="50" readonly="1">
密码:<input id="bbb0" type="text" name="bbb0" size=106 style="width:50px" value="90">
<input name="ccc0" type="checkbox" value="0" onClick="changeCheck(this.value);"> <br>
<input id="aaa1" name="aaa1" type="text" style="width:50px" size=106 value="50" readonly="1">
密码:<input id="bbb1" type="text" name="bbb1" size=106 style="width:50px" value="90">
<input name="ccc1" type="checkbox" value="1" onClick="changeCheck(this.value);"><br>
<input name="hhh0" type="hidden" value="0">
<input name="hhh1" type="hidden" value="0">
<span id="total0"></span><br />
<span id="total1"></span>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<SCRIPT LANGUAGE="JavaScript">
<!--
function changeCheck(v)
{
var aa=eval("aaa"+v);
var bb=eval("bbb"+v);
var cc=eval("ccc"+v);
var tt=eval("hhh"+v);
var oSpan=eval("total"+v);
var a=aa.value;
var b=bb.value;
var total=tt.value;
if(cc.checked){
bb.readonly=true;
bb.disabled = true;
total=parseInt(total)+parseInt(a*b/50);
tt.value=total;
}
else{
bb.readonly=false;
bb.disabled = false;
total=total-a*b/50;
tt.value=total;
}
oSpan.innerHTML="<font color=red size=4>"+total+"</font>";
}
//-->
</SCRIPT>
</head>
<body>
<input id="aaa0" name="aaa0" type="text" style="width:50px" size=106 value="50" readonly="1">
密码:<input id="bbb0" type="text" name="bbb0" size=106 style="width:50px" value="90">
<input name="ccc0" type="checkbox" value="0" onClick="changeCheck(this.value);"> <br>
<input id="aaa1" name="aaa1" type="text" style="width:50px" size=106 value="50" readonly="1">
密码:<input id="bbb1" type="text" name="bbb1" size=106 style="width:50px" value="90">
<input name="ccc1" type="checkbox" value="1" onClick="changeCheck(this.value);"><br>
<input name="hhh0" type="hidden" value="0">
<input name="hhh1" type="hidden" value="0">
<span id="total0"></span><br />
<span id="total1"></span>
</body>
</html>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询