Results 1 to 6 of 6

Thread: DDRivetip and css

  1. #1
    Join Date
    Dec 2006
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default DDRivetip and css

    1) Script Title: DHTML tooltip script

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex5/dhtmltooltip.htm

    3) Describe problem: I would like to control the appearance of each line in the popup. When I try to include styling, the tip is displayed on the page, as opposed to a popup. Here is an example of what I am trying to do:
    PHP Code:
    $color = '#00ff00';
    $width = 300;
    $contents = '<span style="color:red;">Line 1</span>';
    $contents .= '<span style="color:white;">Line 2</span>';
    $contents .= '<span style="color:blue;">Line 3</span>';

    <td><?php echo '<a onMouseover="ddrivetip(\'' $contents '\',\'' $color '\',\'' $width '\' )"; onMouseout="hideddrivetip()"href="' $file_name  '" target="_blank">' $file_name '</a>'?></td>
    When I refresh the page, it displays
    PHP Code:
    Line 1Line 2Line 3','#00ff00','' )"; onMouseout="hideddrivetip()"href="" target="_blank"> 
    So it seems the <> are getting lost. Am I doing something wrong or is this not possible? For what its worth, I can use <font></font> to change the font size and it works fine.

  2. #2
    Join Date
    Dec 2006
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Just an update. This still fails but I've found that if i use <div></div> with no styling that code acts as normal. So it isn't the brackets like I thought. Seems to be the actual css. I'm surprised no one is able to find a solution for this. I would think using css would be quite common.

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,004
    Thanks
    44
    Thanked 3,199 Times in 3,161 Posts
    Blog Entries
    12

    Default

    I don't think that's a problem. It's probably the PHP. Er, rather the markup, script and styles the PHP creates. But basically the PHP.

    Use the browser's 'view source' to see the served content. That might help you see the problem.

    On the other hand, it might have nothing to do with PHP. See if you can reproduce the problem without PHP.

    If you want more help, please include a link to the page on your site that contains the problematic code so we can check it out.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. #4
    Join Date
    May 2012
    Location
    Hitchhiking the Galaxy
    Posts
    1,013
    Thanks
    47
    Thanked 139 Times in 139 Posts
    Blog Entries
    1

    Default

    Also, try it out without the concatenation, and just type it into the outputting string.
    "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program." - Linus Torvalds
    Anime Views Forums
    Bernie

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,004
    Thanks
    44
    Thanked 3,199 Times in 3,161 Posts
    Blog Entries
    12

    Default

    Concatenation has nothing to do with it. I tried out the PHP code in your post and it is the problem. Replace:

    PHP Code:
    $contents '<span style="color:red;">Line 1</span>'
    $contents .= '<span style="color:white;">Line 2</span>'
    $contents .= '<span style="color:blue;">Line 3</span>'
    with:

    PHP Code:
    $contents htmlspecialchars('<span style="color:red;">Line 1 </span>'); 
    $contents .= htmlspecialchars('<span style="color:white;">Line 2 </span>'); 
    $contents .= htmlspecialchars('<span style="color:blue;">Line 3 </span>'); 
    and it works fine. Alternatively you could instead use:

    PHP Code:
    $contents '<span style=\\\'color:red;\\\'>Line 1 </span>'
    $contents .= '<span style=\\\'color:white;\\\'>Line 2 </span>'
    $contents .= '<span style=\\\'color:blue;\\\'>Line 3 </span>'
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #6
    Join Date
    Dec 2006
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    John - Thank you very much for posting the solution. I got pulled away on another product and couldn't respond until now but i didn't want you to think your reply was not appreicated. Your solution worked perfectly. Thank you.

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
  •