PDA

View Full Version : Textual tooltip Script



kgirl
11-01-2005, 09:29 PM
Textual tooltip Script
http://www.dynamicdrive.com/dynamicindex5/linkinfo.htm


Hi I'm a new in all stuff of javascript so be patient with me......................My problem is tha I put dinamically text inside de var content=''"...............And I want to call some event handler inside(ONCLIK EVENT).....like if I want to put links inside the content when a click the link a window opens..........but I can't..........Some ideas to do this ???............

example

<script>
/*<cfoutput query="ShowPrices">*/
content[#ShowPrices.currentrow#]='* <a href="#" onClick="MM_openBrWindow('window.cfm?file=#SESSION.Cat#','1','width=760,height=520')"> Details</a>'
/*</cfoutput>*/
</script>

HELP ME PLEASE! :eek:

jscheuer1
11-01-2005, 10:59 PM
Whenever you have something like this:


arrayName[0]='<a href="some.htm" onclick="alert('You clicked me!')">Click Me</a>'

It will throw an error because single quotes (') are used to delimit the array element and the text for the alert within said element. it should look like this:


arrayName[0]='<a href="some.htm" onclick="alert(\'You clicked me!\')">Click Me</a>'

with the contained delimiters escaped using a downslash (\).

Getting back to your example, if everything else is correct and a downslash will present no problem to the PHP or whatever other code it is you are using in there besides javascript, simply applying the same technique there will solve the problem:


<script>
/*<cfoutput query="ShowPrices">*/
content[#ShowPrices.currentrow#]='* <a href="#" onClick="MM_openBrWindow(\'window.cfm?file=#SESSION.Cat#\',\'1\',\'width=760,height=520\')"> Details</a>'
/*</cfoutput>*/
</script>

kgirl
11-02-2005, 12:10 AM
Thanks for the advice, its really work! :cool: ............

Twey
11-02-2005, 04:32 PM
PHP or whatever other code it is you are using in there besides javascript
ColdFusion :) Hence "cfoutput."