sid1984
07-08-2008, 08:21 PM
I have a java script code. At the end when the user clicks on the button after entering the values in the 3rd page, the values shall be displayed in a new page. Please help me out with the final approach:
<html>
<head>
<script language="LiveScript">
function WinOpen() {
if (document.form1.cap.value == "")
{
alert("Enter value in text box");
return;
}
msg=open("","DisplayWindow","toolbar=no,directories=no,menubar=no, scrollbars=yes");
msg.document.write("<HTML><HEAD><TITLE>Yo!</TITLE></HEAD>");
msg.document.write("<CENTER><h1><B>This is really cool!</B></h1></CENTER>");
msg.document.write('<BODY><form name="form2">');
for(var i =0; i < document.form1.cap.value; i++)
{
msg.document.write("<INPUT type=text name=tbAlphaNumeric[i]>");
msg.document.write("<br>");
}
msg.document.write('<input type="button" name="Button2" value="Steal" onClick="javascript:window.opener.WinShow();">');
msg.document.write('</form></BODY></HTML>');
}
function WinShow() {
msg=open("","DisplayWindow","toolbar=no,directories=no,menubar=no, scrollbars=yes");
msg.document.write("<HTML><HEAD><TITLE>Great!</TITLE></HEAD>");
msg.document.write("<CENTER><h1><B>Display of second page text elements!</B></h1></CENTER>");
for(var j =0; j < document.form1.cap.value; j++)
{
msg.document.write(document.form2.tbAlphaNumeric[j].value);
msg.document.write("<br>");
}
msg.document.write('</form></BODY></HTML>');
}
</script>
</head>
<body>
<form name="form1">
<INPUT type= "text" name=cap>
<input type="button" name="Button1" value="Push me" onClick="WinOpen()">
</form>
</body>
</html>
<html>
<head>
<script language="LiveScript">
function WinOpen() {
if (document.form1.cap.value == "")
{
alert("Enter value in text box");
return;
}
msg=open("","DisplayWindow","toolbar=no,directories=no,menubar=no, scrollbars=yes");
msg.document.write("<HTML><HEAD><TITLE>Yo!</TITLE></HEAD>");
msg.document.write("<CENTER><h1><B>This is really cool!</B></h1></CENTER>");
msg.document.write('<BODY><form name="form2">');
for(var i =0; i < document.form1.cap.value; i++)
{
msg.document.write("<INPUT type=text name=tbAlphaNumeric[i]>");
msg.document.write("<br>");
}
msg.document.write('<input type="button" name="Button2" value="Steal" onClick="javascript:window.opener.WinShow();">');
msg.document.write('</form></BODY></HTML>');
}
function WinShow() {
msg=open("","DisplayWindow","toolbar=no,directories=no,menubar=no, scrollbars=yes");
msg.document.write("<HTML><HEAD><TITLE>Great!</TITLE></HEAD>");
msg.document.write("<CENTER><h1><B>Display of second page text elements!</B></h1></CENTER>");
for(var j =0; j < document.form1.cap.value; j++)
{
msg.document.write(document.form2.tbAlphaNumeric[j].value);
msg.document.write("<br>");
}
msg.document.write('</form></BODY></HTML>');
}
</script>
</head>
<body>
<form name="form1">
<INPUT type= "text" name=cap>
<input type="button" name="Button1" value="Push me" onClick="WinOpen()">
</form>
</body>
</html>