[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

onmouseover quote useages

Posted on 2006-05-16
8
Medium Priority
?
424 Views
Last Modified: 2010-07-27
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?
0
Comment
Question by:redcable
  • 4
  • 4
8 Comments
 
LVL 5

Expert Comment

by:shaggy_the_sheep
ID: 16693192
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
0
 
LVL 63

Accepted Solution

by:
Zvonko earned 2000 total points
ID: 16693932
You cannot escape chars in HTML source, only in script source.

Therefore you have to use one sort of quotes inside a quoted HTML string.
Like 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>


0
 
LVL 5

Expert Comment

by:shaggy_the_sheep
ID: 16693965
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
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 63

Expert Comment

by:Zvonko
ID: 16693973
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.

0
 
LVL 5

Expert Comment

by:shaggy_the_sheep
ID: 16693985
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.
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 16693994
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.

0
 
LVL 5

Expert Comment

by:shaggy_the_sheep
ID: 16694045
oh yes i understand what you mean...thanks for clearing it up

Richard
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 16694079
You are welcome.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question