...

View Full Version : Passing JavaScript variables from one window to a newly opened window.



wolf1728
01-03-2011, 01:15 AM
Here is the program: http://www.1728.com/newwindow.htm
Basically, I want to input a number in the input box, which assigns a number to the variable numval located at document.box1.b1.

When clicking on the "new window" button, an alert displays the input box value, then another window opens and displays the integers 1 through 12 and the amount squared.

I would like the new window to obtain the number from the previous window so that the new window will display integers (and their squares) from 1 to the value of numval.

Logic Ali
01-03-2011, 11:47 AM
Here is the program: http://www.1728.com/newwindow.htm
Basically, I want to input a number in the input box, which assigns a number to the variable numval located at document.box1.b1.

When clicking on the "new window" button, an alert displays the input box value, then another window opens and displays the integers 1 through 12 and the amount squared.

I would like the new window to obtain the number from the previous window so that the new window will display integers (and their squares) from 1 to the value of numval.

Number( opener.document.forms.box1.b1.value );

The entered value must be validated as a number.

wolf1728
01-04-2011, 07:22 PM
LogicAli
I tried but could not get that to work.
Basically, I need this explained on a more fundamental level.
For example, does that line of code go into the original window or the new window?

Logic Ali
01-04-2011, 07:58 PM
LogicAli
I tried but could not get that to work.
Basically, I need this explained on a more fundamental level.
For example, does that line of code go into the original window or the new window?
It goes in the new window and evaluates to the value entered in the parent window's form.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum