dcsimg
www.webdeveloper.com
Results 1 to 11 of 11

Thread: wz_tooltip.js ToolTip Problem

  1. #1
    Join Date
    Jun 2006
    Posts
    5

    wz_tooltip.js ToolTip Problem

    Can anyone get the following html to work, you will need to get wz_tooltip.js from walterzorn.com

    <html>
    <head>
    <title>ToolTipTest.html</title>
    <script>
    function displayTest() {
    var divId = document.getElementById("divId")
    var html = "<table><tr><td onmouseover=\"return escape('This does not work')\">This does not work</td></tr></table>";
    divId.innerHTML = html;
    }
    </script>
    </head>

    <body>
    <a href='' onclick='displayTest();return false'>test on</a>
    <br>
    <table>
    <tr>
    <td onmouseover="return escape('This Works')" >This Works</td>
    </tr>
    </table>
    <br>
    <script language="JavaScript" type="text/javascript" src="wz_tooltip.js"></script>
    <div id="divId"><div>
    </body>
    </html>

  2. #2
    Join Date
    Dec 2004
    Posts
    8,637
    First, I recoded your HTML so that both examples will work if you replace the escape() with an alert().
    HTML Code:
    <html>
    <head>
    <title>ToolTipTest.html</title>
    <script>
    function displayTest() {
    var divId = document.getElementById("divId")
    var html = '<table><tr><td onmouseover="return escape(\'This might not work.\');">This does not work<\/td><\/tr><\/table>';
    divId.innerHTML = html;
    }
    </script>
    </head>
    
    <body>
    <a href="javascript:void(0)" onclick="displayTest();return false;">test on</a>
    <br>
    <table>
    <tr>
    <td onmouseover="return escape('This still works.');">This Works</td>
    </tr>
    </table>
    <br>
    <script language="JavaScript" type="text/javascript" src="wz_tooltip.js"></script>
    <div id="divId"><div>
    </body>
    </html>
    I did not get that tooltip script. But, does it work, now, with the re-coded HTML?
    Otherwise, I would guess that script won't work with dynamically inserted elements.
    Last edited by phpnovice; 06-07-2006 at 01:14 AM.

  3. #3
    Join Date
    Jun 2006
    Posts
    5
    It still does not work, If I replace escape() with alert() it does work.

    You can get wz_tooltip.js free at...

    http://www.walterzorn.com/tooltip/to...e.htm#download

  4. #4
    Join Date
    Dec 2004
    Posts
    8,637
    It is as I suspected. That script won't work with, and is not intended to work with, dynamically inserted elements.

  5. #5
    Join Date
    Jun 2006
    Posts
    5
    Do you know why it does not work?

  6. #6
    Join Date
    Dec 2004
    Posts
    8,637
    Because the dynamic element did not exist at the time the script was run. The script is run at document load time. Any elements added after that were unknown to the script -- which, therefore, could not make the necessary modifications to them (because they didn't exist at the time the script was looking for work to do).

  7. #7
    Join Date
    Jun 2006
    Posts
    5

    wz_tooltip.js ToolTip Problem Solved

    Here is the new html and also a changed snippet from wz_tooltip.js

    <html>
    <head>
    <title>ToolTipTest.html</title>
    <script>
    function displayTest() {
    var divId = document.getElementById("divId")
    var html = "<table><tr><td onmouseover=\"return escape('This now works')\">This now works</td></tr></table>";
    divId.innerHTML = html;
    tt_Init(); // call wz init function again, it now writes to div instead of document
    }
    </script>
    </head>

    <body>
    <a href='' onclick='displayTest();return false'>test on</a>
    <br><br>
    <table>
    <tr>
    <td onmouseover="return escape('This Works')" >This Works</td>
    </tr>
    </table>
    <br>
    <div id="divId"></div>
    <div id="ttTest"></div>
    <script language="JavaScript" type="text/javascript" src="wz_tooltip.js"></script>
    </body>
    </html>



    From End Of tt_Init() function;
    if(t_tj.title) t_tj.title = "";
    }
    }
    }

    var theDiv = document.getElementById("ttTest");
    theDiv.innerHTML = htm;
    //document.write(htm);
    if(document.getElementById) tt_ifrm = document.getElementById("TTiEiFrM");
    }

    tt_Init();

  8. #8
    Join Date
    Jul 2006
    Posts
    2
    martyb, did you finally get it to work?

    per your last entry I tried modifying wz_tooltip.js to no avail. Does it in your example really work for both the entire document and also for the dynamic portion?

    I'm trying to get an ajax based environment with dynamic content to work, but feel like hitting my head against a wall at this point...

    Any thoughts on how to properly do this?

    Thanks, Oliver

  9. #9
    Join Date
    Jun 2006
    Posts
    5

    Final outcome

    What we ended up doing was the following;
    1) Used the wz library unaltered, ("out of the box" so to speak)
    2) instead of dynamically generating the div contents of the jsp, we coded all html entries, but set the style to hidden. This allowed the wz lib to scan the whole document to find every possible tooltip reference. This is the way that wz had intended the lib to be used.

    This will probably not work for you, especially if you have no advanced knowledge of what the dynamically genetrated html we be.

    Dynamically generating the html and then trying to make the wz lib rescan the document when the html was changed ( elements added or subtracted) via DHTML did not work for me with IE.

  10. #10
    Join Date
    Jul 2006
    Posts
    2
    Thanks for the feedback! In my case I can't do without the dynamic content and for the time being have to drop the tooltips for that part. But I received an email from Walter and he is planning to incorporate additional flexibility (to support these type of environments) in a future release...when? He didn't say

  11. #11
    Join Date
    Jul 2006
    Location
    Lannion, France
    Posts
    1

    Talking

    Quote Originally Posted by OliverS
    Thanks for the feedback! In my case I can't do without the dynamic content and for the time being have to drop the tooltips for that part. But I received an email from Walter and he is planning to incorporate additional flexibility (to support these type of environments) in a future release...when? He didn't say
    It is really good news : I too wish to use all Walter scripts with Ajax (you can already use almost fully its drag and drop lib dynamically).
    The tooltip lib would be really useful (it is already great in "normal" pages).

    If Walter has beta versions to test, don't hesitate to ask

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles