Gossamer Forum
Home : Products : Links 2.0 : Customization :

Javascript and Title

Quote Reply
Javascript and Title
I have a javascript Mouse Over display the title, but it seems that there is an error depending on the title. I haven't narrowed it down exactly, but when there is some form of punctuation in the title then it expects another ;
Here is the code that I have:
Code:
<b><a target="_new" class="link" href="<%db_cgi_url%>/jump.cgi?ID=<%ID%>"onMouseOver="status='<%Title%>'; return true"
onMouseOut="status=''; return
true"><%Title%></a></b>
Any ideas of what I can do so I don't get any debug error?
Thanks,
Adam

Quote Reply
Re: Javascript and Title In reply to
I'm not a Java ( or even a Perl ) expert but I do know that if you have a an single quote mark ( apostrophe ) as part of the window.status that you must "escape" the apostrophe with a "\". For example,

| <A HREF="<%build_root_url%>" onMouseOver="window.status=' Here\'s the directory page'; return true" onMouseOut="window.status=' '">Home</A>

You would need to put a "\" in the word "Here's" so that it looked like "Here\'s." ( You do the same thing in the field definition in links.def - $ becomes \$ if you wanted to use it in a new field called price for example -- it is a special character in Perl ).

When I want to insert a link, my html editor has a wizard which disables the single quote mark for the status message.

So, if your <%Title%> has a single quote mark in it, you would probably need the "\". I know the single quote mark is a problem...not sure about other punctuation. Maybe someone has a sub-routine that would parse the word and insert the "\" as necessary.

By the way, are you sure that the second "return true"><%Title%>," which appears as part of the onMouseOut, is correct...?

onMouseOut="status=' '; return true"><%Title%></a></b>

Maybe it should be - onMouseOut="status=' '"></a></b>


Like I said, I am no expert...just slugging my way through this stuff.....

Gene