Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Servlet/JSP/JSF/JavaFX Script  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
reply to postflat modethreaded modego to previous topicgo to next topicgo to back
作者 javascript里如何比较数值?
redhobor





发贴: 5
于 2005-03-20 08:50 user profilesend a private message to userreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
<script language="javascript" type="">
<!--
//Check the total weight of exams and courseworks
function calculateWeight() {
var weight, weight1, weight2;
weight1=document.frm.rst_exmtotalweight.value;
weight2=document.frm.rst_cwktotalweight.value;
weight=weight1+weight2;
if (weight!=100){
window.alert("The total weight of exams and courseworks is not correct!");
document.getElementById("rst_cwktotalweight").focus();
return false;
}
frm.submit();
}
//-->
</script>
<form name="frm" method="post" action="definemdlstructservlet" onsubmit="return calculateWeight(this);">
<tr bgcolor="#CCCCCC">
<td>How many weight of exams? [100%] </td>
<td width="56%" bgcolor="#FFFFFF">
<input type="text" id="rst_exmtotalweight" name="rst_exmtotalweight" value="0" size="5" style="display:none;">
</td>
</tr>
<tr bgcolor="#CCCCCC">
<td>How many weight of courseworks? [100%] </td>
<td width="56%" bgcolor="#FFFFFF">
<input type="text" id="rst_cwktotalweight" name="rst_cwktotalweight" value="0" size="5" style="display:none;">
</td>
</tr>
</table>
<p> </p>
<p>
<input type="submit" name="Submit" value="Submit">
<input type="reset" name="Reset" value="Reset">
<input type="button" name="back" value="Back" onClick="history.back(-1)">
</p>
</form>
为什么我输入数值后,即使相加等于100,仍然会出现错误警告。
如果从数据库得的rst_exmtotalweight和rst_cwktotalweight都是double类型数据,程序需要改进吗?
谢谢!




话题树型展开
人气 标题 作者 字数 发贴时间
1388 javascript里如何比较数值? redhobor 1610 2005-03-20 08:50
1228 Re:javascript里如何比较数值? caozhe2005 24 2005-04-04 14:32

reply to postflat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923