Link to home
Start Free TrialLog in
Avatar of redcable
redcable

asked on

onmouseover quote useages

Hi guys,

Im emplementing a png fix for IE however I am trying to do it on a mouseover(tooltip) which is being handled by domTT.

Heres my problem, I think I need to learn my quote useage and or a new way for doing this what im trying to do below.

the basic link
<a href="index.htm"  onmouseover="domTT_activate(this, event, 'content', 'actual text or image goes here');">the link</a>

Now i need to put the image in where it says "actual text or image goes here"

<a href="index.htm"  onmouseover="domTT_activate(this, event, 'content', '<img src="/images/riskfree.png" alt="foo" width="10" height="20" onload="fixPNG(this)">');">the link</a>

Now that wont work im pretty sure because of the quote situation. anyone have any ideas on how best to do this?
Avatar of shaggy_the_sheep
shaggy_the_sheep

Hi

I'm not sure if this will fix it but if you replace the double quotes around the image source, alt text and border with \' then that should fix it

Richard
ASKER CERTIFIED SOLUTION
Avatar of Zvonko
Zvonko
Flag of North Macedonia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
i replaced the double quotes with \' on my home pc and it worked fine. I'm not escaping the HTML quotes...i am simply replacing them with single quotes. I need to escape the single quotes to allow the javascript to work correctly
If your prefer your original version, then check this:

<a href="index.htm"  onmouseover="domTT_activate(this, event, 'content', '<img src=\'/images/riskfree.png\' alt=\'foo\' width=\'10\' height=\'20\' onload=\'fixPNG(this)\'>');">the link</a>

As you see, the starting quotation characters for the onmouseover string MUST NOT! be used inside the string.

i see you what you are saying.

i think i wasn't clear in my original anwser....it is only necessary to escape the quotes within the onmouseover event.
When you have understood the concept then you can do it as you like it, but you cannot use the same quotation character for string surrounding and inside the quoted HTML string.

oh yes i understand what you mean...thanks for clearing it up

Richard
You are welcome.