SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    boiler up blackdog's Avatar
    Join Date
    Jul 2002
    Location
    Purdue
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    semi colon in echo

    i have some javascript that i want to echo, and there's a semi colon in it. i keep getting a javascript error, but the javascript looks right to me. is the semi colon causing the problem?
    thanks
    PHP Code:
    echo "<tr><td class=content width=280px bgcolor=#F4F5F6><a href = \"javascript:void\" onclick = \"window.open(",$url," );\">"

  2. #2
    boiler up blackdog's Avatar
    Join Date
    Jul 2002
    Location
    Purdue
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    this is weird... there's no space inbetween java and script, but it got added in. i tried to edit it out, but it keeps coming back

  3. #3
    ********* Wizard silver trophy Cam's Avatar
    Join Date
    Aug 2002
    Location
    Burpengary, Australia
    Posts
    4,495
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    First of all, it's the forum software that puts the space in between java and script, don't worry about that

    The reason it's not working is that the URL needs to be inside quotes. Try this instead
    PHP Code:
    echo( "<tr><td class='content' width='280px' bgcolor='#F4F5F6'><a href='javascript:void' onclick=\"window.open('",$url,"');\">" ); 

  4. #4
    boiler up blackdog's Avatar
    Join Date
    Jul 2002
    Location
    Purdue
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    doh! thanks!


Bookmarks

Posting Permissions

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