Results 1 to 5 of 5

Thread: Cool DHTML tooltip script

  1. #1
    Join Date
    Jul 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Cool DHTML tooltip script

    1) Script Title: Cool DHTML tooltip script

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...tmltooltip.htm

    3) Describe problem: Is there an easy way to add the text color into the function or has this already been done elsewhere?

  2. #2
    Join Date
    Apr 2006
    Posts
    429
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    this already been done elsewhere?
    search the DD forums
    Please don't mind me. I am just posting a lot of nonsense.

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    This is a pretty good way to have that kind of control:

    http://www.dyn-web.com/dhtml/tooltips/

    It is the latest from the author of DD's:

    http://www.dynamicdrive.com/dynamici...agetooltip.htm

    and works in more browsers but is 'creditware'. Here is an intermediate version I put together in another thread:

    http://www.dynamicdrive.com/forums/s...41&postcount=5
    - John
    ________________________

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

  4. #4
    Join Date
    Jul 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by jscheuer1
    This is a pretty good way to have that kind of control:

    http://www.dyn-web.com/dhtml/tooltips/

    It is the latest from the author of DD's:

    http://www.dynamicdrive.com/dynamici...agetooltip.htm

    and works in more browsers but is 'creditware'. Here is an intermediate version I put together in another thread:

    http://www.dynamicdrive.com/forums/s...41&postcount=5
    I looked at those, but they set the text/html in the JS and I need something that I can use PHP vars on as I'm pulling the tooltip data from a mysql db.

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by juanschwartz
    I looked at those, but they set the text/html in the JS and I need something that I can use PHP vars on as I'm pulling the tooltip data from a mysql db.
    If you look at the entire thread:

    http://www.dynamicdrive.com/forums/s...2041#post42041

    You will see that the tips can be entered just about anywhere in the first linked code from my previous post. However, as I really didn't know what you meant by:

    add the text color into the function
    and now see that you want (probably) to add it in at the mouse event, you can do that with the script you mentioned, it is just a little tricky, ex:

    Code:
    onMouseover="ddrivetip('<span style=\'color:red;\'>JavaScriptKit.com JavaScript tutorials</span>','yellow', 300)"
    as you cannot use the traditional double quotes to delimit a tag's attribute value inside the event call and, though you can use single quotes as a substitute, you need to escape them (as shown above) with a down slash (\).

    You could alternatively modify the ddrivetip() function to look like so:

    Code:
    function ddrivetip(thetext, thecolor, thewidth, textcolor){
    if (ns6||ie){
    if (typeof thewidth!="undefined" && thewidth!="") tipobj.style.width=thewidth+"px";
    if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor;
    if (typeof textcolor!="undefined" && textcolor!="") tipobj.style.color=textcolor;
    else
    tipobj.style.color='';
    tipobj.innerHTML=thetext;
    enabletip=true;
    return false;
    }
    }
    Then you could set the text color as the last argument here:

    Code:
    onMouseover="ddrivetip('JavaScriptKit.com JavaScript tutorials','yellow', 300, 'red')"
    - John
    ________________________

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

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
  •