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 5 of 5
  1. #1
    Regular Coder
    Join Date
    Apr 2005
    Posts
    388
    Thanks
    0
    Thanked 0 Times in 0 Posts

    passing a variable to a function

    howdy,
    I have written a little script that I need to pass a variable to can this be done, if so how? below is the script and the way I am calling it thanks.
    btw, this is the first actual js script I have ever written if it is messy please forgive.

    Code:
    <script language="javascript">
    function sendto()
    {
    window.open('<? echo "../merchants/".$sento; ?>','newwin' ,'toolbar,scrollbars,resizable, width=640 , height=480');
    }
    </script>
    Here is how I am calling it.
    Code:
    echo "<tr><td><a href='$url' onClick='sendto()'>$value</a>-$max $z available</td></tr>";
    I am in fact trying to send a php variable by using echo, I have done this successfully in other js scripts that I have used.

  2. #2
    Senior Coder
    Join Date
    Mar 2005
    Location
    Portsmouth UK
    Posts
    4,583
    Thanks
    3
    Thanked 516 Times in 503 Posts
    look at the rendered HTML to see whats wrong
    Vic

    God Loves You and will never love you less.

    http://www.vicsjavascripts.org/Home.htm

    If my post has been useful please donate to http://www.operationsmile.org.uk/

  3. #3
    Regular Coder
    Join Date
    Apr 2005
    Posts
    388
    Thanks
    0
    Thanked 0 Times in 0 Posts
    this is working ok, but it wont find the file that $sento is supposed to be. I can enter a static address http://www.yahoo.com and it goes right to it. So I dont think $sento is being passed to it? any ideas?

    tia.

  4. #4
    Senior Coder
    Join Date
    Mar 2005
    Location
    Portsmouth UK
    Posts
    4,583
    Thanks
    3
    Thanked 516 Times in 503 Posts
    post the rendered HTML
    Vic

    God Loves You and will never love you less.

    http://www.vicsjavascripts.org/Home.htm

    If my post has been useful please donate to http://www.operationsmile.org.uk/

  5. #5
    Regular Coder
    Join Date
    Apr 2005
    Posts
    388
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks, but I figured it out this morning. Working great, no problem with the php as mentioned earlier.


 

Posting Permissions

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