Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Aug 2008
    Location
    Boston, MA
    Posts
    24
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Passing JavaScript variables from one window to a newly opened window.

    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.
    Last edited by wolf1728; 01-03-2011 at 01:18 AM.

  • #2
    Senior Coder Logic Ali's Avatar
    Join Date
    Sep 2010
    Location
    London
    Posts
    1,028
    Thanks
    0
    Thanked 207 Times in 202 Posts
    Quote Originally Posted by wolf1728 View Post
    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.

  • #3
    New Coder
    Join Date
    Aug 2008
    Location
    Boston, MA
    Posts
    24
    Thanks
    9
    Thanked 0 Times in 0 Posts
    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?

  • #4
    Senior Coder Logic Ali's Avatar
    Join Date
    Sep 2010
    Location
    London
    Posts
    1,028
    Thanks
    0
    Thanked 207 Times in 202 Posts
    Quote Originally Posted by wolf1728 View Post
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •