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>
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.
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).
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>
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...
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.
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
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
Bookmarks