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 6 of 6

Thread: Pass variable

  1. #1
    New Coder
    Join Date
    Aug 2002
    Posts
    22
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question Pass variable

    Hellow,

    I want to send a varable from a pop-up window to a form input value.

    If tried this (its within php)
    <a href='#' onclick=\"parent.membersadd.location.value = '$city'\">add</a>

    membersadd is the name of the form and location the name of the inputbox

    But it doesnt work if u know were i went wrong pleace help me.

  • #2
    Regular Coder
    Join Date
    May 2007
    Posts
    118
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try

    Code:
    window.opener.membersadd.location.value = ''
    Forum for webmasters and developers
    http://www.htmlfrenzy.com
    Are you an IT expert? Join our Reward system
    www.htmlfrenzy.com/reward-system.php

  • #3
    New Coder
    Join Date
    Aug 2002
    Posts
    22
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question re

    No that doesnt work. remember im trying to send from a popup window.

  • #4
    Regular Coder
    Join Date
    May 2007
    Posts
    118
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sets or retrieves a reference to the window that created the current window.
    http://msdn2.microsoft.com/en-us/library/ms534309.aspx

    That means, you have a bug somewhere in your code either wrong manipulation with php or with DOM.
    Forum for webmasters and developers
    http://www.htmlfrenzy.com
    Are you an IT expert? Join our Reward system
    www.htmlfrenzy.com/reward-system.php

  • #5
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,037
    Thanks
    0
    Thanked 250 Times in 246 Posts
    Code:
    function setLocation(city){
       if (opener && !opener.closed){
          opener.document.membersadd.location.value = city;
          opener.focus();
       }
       window.close();
       return false;
    }
    PHP Code:
    echo "<a href=\"#\" onclick=\"return setLocation('$city');\">add</a>" //syntax may be wrong as I don't know PHP; 
    Remove focus() and close() statements if the popup is not supposed to close if the Add link is clicked.

  • #6
    New Coder
    Join Date
    Aug 2002
    Posts
    22
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Cool re

    Thanx that is exacly what i needed


  •  

    Posting Permissions

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