本文发表在 rolia.net 枫下论坛Hi, friends, Happy long weekwend.Here i have some problems with javascript.
Could you guys give me some solutions? Thank you in advance.
1.how to plus mathematically?
What I get is 2+3=23.Give me an example please.
2.in terms of form, the name of the input can't be array? but I really want it.
In the following code, I want:
1.get the result of n1+n2+n3
2, the name of input use array.
But I can't, Could you guys show me a solution.
Thanks a lot.
------------------------------------
<html>
<head>
<title>try</title>
<script language="Javascript">
var row1()=new Array();
var row2()=new Array();
var row3()=new Array();
function plus()
{
var r1=document.theform.row1(1).value;
var r2=document.theform.row2(1).value;
var r3=document.theform.row3(1).value;
var result=r1+r2+r3
alert (r1+"pluses"+r2+"plues"+r3+"is"+result)
}
</script>
</head>
<body>
<form name="theform" >
n1<input type="text" name="row1(1)"><br>
n2<input type="text" name="row2(1)"><br>
n3<input type="text" name="row3(1)"><br>
<a href="#" onClick="plus();return false">plus</a>
</form>
</body>
</html>更多精彩文章及讨论,请光临枫下论坛 rolia.net
Could you guys give me some solutions? Thank you in advance.
1.how to plus mathematically?
What I get is 2+3=23.Give me an example please.
2.in terms of form, the name of the input can't be array? but I really want it.
In the following code, I want:
1.get the result of n1+n2+n3
2, the name of input use array.
But I can't, Could you guys show me a solution.
Thanks a lot.
------------------------------------
<html>
<head>
<title>try</title>
<script language="Javascript">
var row1()=new Array();
var row2()=new Array();
var row3()=new Array();
function plus()
{
var r1=document.theform.row1(1).value;
var r2=document.theform.row2(1).value;
var r3=document.theform.row3(1).value;
var result=r1+r2+r3
alert (r1+"pluses"+r2+"plues"+r3+"is"+result)
}
</script>
</head>
<body>
<form name="theform" >
n1<input type="text" name="row1(1)"><br>
n2<input type="text" name="row2(1)"><br>
n3<input type="text" name="row3(1)"><br>
<a href="#" onClick="plus();return false">plus</a>
</form>
</body>
</html>更多精彩文章及讨论,请光临枫下论坛 rolia.net