Today, when developing a Web application, write a small function with Javascipt to do the following things:
That is, change the Bille coefficient, the back of my hospital accounted for automatically change. The function is very simple, with onchange= "" can be implemented, but my code is as follows:
Code 1:
<TD width= "><input type=" text "name=" Xzgs "id=" xzgs<%=i%> "value=" <%=dlist.get (i). GETGS ()%> " style=" width:50px; "/></td>
<td width=" ><input type= "text" name= "Bili" id= "bili<%=i%>" value= "1" onchange= "wyzb(<%=i%>);" Style= "width:50px; "/></td>
<td width=" ><input type= "text" name= "Wyzb" id="Wyzb <% =i%> " value=" <%=dlist.get (i) Getgs ()%> " style=" width:50px; "></input></td>
This is to call JS code, JS code is as follows:
Code 2:
<script type= "Text/javascript" src= "js/jquery.js" ></script>
<title> segment </title>
<script type= "Text/javascript" >
function Wyzb (i) {
var xg=new number ($ ("#xzgs" +i). Val ());
var bl=new number ($ ("#bili" +i). Val ());
var sumvalue=new number (XG*BL);
$ ("#wyzb" +i). attr ("value", Sumvalue);
}
</script>
But the Web page just does not execute this JS code, with the Chrome debugging (review element-console) after found in "Uncaught typeerror:object is not a function".
Toss half a day to find in the call JS Code JSP page problems, such as Code 1 won the red part, onchange called the function name and the following ID duplicate, will Wyzb () function name to change it.