SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru
    Join Date
    Dec 2005
    Posts
    964
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Javascript/dhtml call within PHP

    I can't figure this out... Im trying to set some tooltips on my page, but if I put them inside a <?PHP it doesnt work... Why?

    This is how it look outside PHP
    Code HTML4Strict:
    <a href="http://www.newsite.com" onMouseover="tooltip('This is a test...')";
     onMouseout="hidetooltip()">My Link</a>

    This is how it looks inside php:
    PHP Code:
    echo '<a href="http://www.newsite.com" onMouseover="tooltip('This is a test...')";
     onMouseout="hidetooltip()">My Link</a>'

    Thanks in advance...

  2. #2
    SitePoint Guru
    Join Date
    Jul 2005
    Location
    Orlando
    Posts
    634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You are beginning your PHP string with a single quote (') and you have a single quote inside the string, inside the tooltip function call. You'll need to escape that single quote with a backslash (\')


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
  •