#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2002
    Location
    Quazar
    Posts
    207
    Rep Power
    13

    Javascript in PHP


    I almost there but I just can't fingure this out.
    I just want to put in a pop up window script inside a php script but since javascript uses alot of double and single quotes, I'm not sure how to put it in.

    echo "<A href='#' onClick=window.open('poll/results.php','lalala','height=200','width=200')>Results</a>";

    This is what I have so far and it does pop up but the width doesn't work.

    Does this look right? is my format really screwy?
  2. #2
  3. mod_dev_shed
    Devshed Supreme Being (6500+ posts)

    Join Date
    Sep 2002
    Location
    Atlanta, GA
    Posts
    14,817
    Rep Power
    1100
    You should get some quotes around the javascript too. The width isn't working b/c you closed the quotes on the third argument of the open() function; it should be open quote, argument comma argument comma argument close quote.
    PHP Code:
    echo "<a href=\"#\" onclick=\"javascript:window.open('poll/results.php', 'pollResults', 'height=200, width=200')\">Results</a>"

IMN logo majestic logo threadwatch logo seochat tools logo