what i want is that i could send the value that is stored in the array
For example i have array of
result[0] = 1
can i put in my form
instead of 1?Code:<form action="2.html?right=result[0]&wrong=0" method="post">
html 1Code:<form action="2.html?right=1&wrong=0" method="post">
Code:<!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>Untitled Document</title> </head> <body> <script type="text/javascript"> var result=new Array(); // regular array (add an optional integer result[0]=2; // argument to control array's size) var a = parseInt(result[0]); result[1]="0"; document.write(result[0]); document.write(a); </script> <table width="315" border="1"> <tr> <td width="107"> -13-6=-23 </td> <td width="76"><form action="2.html?right=a&wrong=0" method="post"><INPUT TYPE="submit" VALUE="RIGHT"><input type="hidden" name="result[0]"/></form></td> <td width="110"><form action="2.html?right=0&wrong=1" method="post"><INPUT TYPE="submit" VALUE="WRONG"></form></td> </tr> </table> </body> </html>
html 2
Code:<!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>Untitled Document</title> <SCRIPT LANGUAGE="JavaScript"> <!-- This script and many more are available free online at --> <!-- The JavaScript Source!! http://javascript.internet.com --> <!-- Begin function getParams() { var idx = document.URL.indexOf('?'); var params = new Array(); if (idx != -1) { var pairs = document.URL.substring(idx+1, document.URL.length).split('&'); for (var i=0; i<pairs.length; i++) { nameVal = pairs[i].split('='); params[nameVal[0]] = nameVal[1]; } } return params; } params = getParams(); // End --> </script> </head> <body> <table width="315" border="1"> <tr> <td width="107"> -13-8=-21 </td> <td width="76"> </td> <td width="110"> </td> </tr> </table> <SCRIPT LANGUAGE="JavaScript"> var result=new Array(); <!-- Begin result[0] = 1; //result[0] = result[0] + parseInt(unescape(params["right"])); result[0] = unescape(params["right"]); result[1] = unescape(params["wrong"]); var name = unescape(params["name"]); // regular array (add an optional integer document.write(result[0] + result[1]); document.write(name); // End --> </script> </body> </html>


Reply With Quote
Bookmarks