首页 > 代码库 > js如何实现把文本框中的值计算之后回写到文本框中
js如何实现把文本框中的值计算之后回写到文本框中
js如何实现把文本框中的值计算之后回写到文本框中
<script type="text/javascript"> function cal(){ /* int value1 = document.getElementByName("subjectCount"); int value2 = document.getElementByName("subjectScore"); int value3 = value1*value2;
<%@ page language="java" import="java.util.*" pageEncoding="gbk"%><%@ taglib prefix="s" uri="/struts-tags"%><html> <head> <title>自动组卷页面</title> <style type="text/css"> <!-- body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; background-color: #EEF2FB; } #addSubjectForm table td{ font-size:12px; } --> </style> <link href="images/skin.css" rel="stylesheet" type="text/css"> <script type="text/javascript"> function cal(){ /* int value1 = document.getElementByName("subjectCount"); int value2 = document.getElementByName("subjectScore"); int value3 = value1*value2; alert(value3); document.getElementByName("allCount").value=http://www.mamicode.com/value3;"xx1").value)*0.0; var value2 = (document.getElementById("xx2").value)*0.0; var total=parseInt(document.getElementById(‘xx1‘).value)*parseInt(document.getElementById(‘xx2‘).value); document.getElementById(‘xx3‘).value = http://www.mamicode.com/total;></script> </head><body> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="17" valign="top" background="images/mail_leftbg.gif"><img src="images/left-top-right.gif" width="17" height="29" /></td> <td valign="top" background="images/content-bg.gif"><table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2"> <tr> <td height="31"><div class="titlebt">自动组卷</div></td> </tr> </table></td> <td width="16" valign="top" background="images/mail_rightbg.gif"><img src="images/nav-right-bg.gif" width="16" height="29" /></td> </tr> <tr> <td valign="middle" background="images/mail_leftbg.gif"> </td> <td valign="top" bgcolor="#F7F8F9"><table width="98%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="53%" valign="top"> </td> </tr> <tr> <td valign="middle"><span class="left_txt"> <div id="autoPaperForm" align="center"><!--自动组卷表单--> <form action="autoPaper.action" method="post"> <table border="0" cellspacing="10" cellpadding="0"> <tr> <td colspan="2"><FONT color="red"><s:actionerror/></FONT></td> </tr> <tr> <td>选择题的数量:</td> <td><input type="text" id="xx1" name="subjectCount" size="20" ></td> </tr> <tr> <td>每题分数:</td> <td><input type="text" id="xx2" name="subjectScore" size="20" ></td> </tr> <tr> <td>考试时间:</td> <td><input type="text" name="time" size="20" ></td> </tr> <tr> <td>总分:</td> <td><input type="text" id="xx3" name="allCount" size="20" onm ousemove="cal()" value ="" ></td> </tr> <tr> <td colspan="2"><div align="center"> <input type="submit" value="录入"> <input type="reset" value="重置"> </td> </tr> </table> </form> </div> </td> </tr> </table></td> <td background="images/mail_rightbg.gif"> </td> </tr> <tr> <td valign="bottom" background="images/mail_leftbg.gif"><img src="images/buttom_left2.gif" width="17" height="17" /></td> <td background="images/buttom_bgs.gif"><img src="images/buttom_bgs.gif" width="17" height="17"></td> <td valign="bottom" background="images/mail_rightbg.gif"><img src="images/buttom_right2.gif" width="16" height="17" /></td> </tr></table></body></html>
alert(value3); document.getElementByName("allCount").value=http://www.mamicode.com/value3;"xx1").value)*0.0; var value2 = (document.getElementById("xx2").value)*0.0; var total=parseInt(document.getElementById(‘xx1‘).value)*parseInt(document.getElementById(‘xx2‘).value); document.getElementById(‘xx3‘).value = http://www.mamicode.com/total;></script>
js如何实现把文本框中的值计算之后回写到文本框中
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。