onclick event not firing in Chrome -...

User 81823 Photo


Registered User
52 posts

**sighs - when will my troubles end!**

HaHa only joking...

I have an image map that is gorgeous and wonderful and pretty and all that, the only problem is that the onclick event I have put in does not work in Google Chrome.

It works fine in IE8.

Any ideas as I have noticed in various other threads on other sites that Chrome has trouble with onclick and posted workarounds but I have not found a solution for an image map.

Any ideas?

Thanks,
Neil.


User 364143 Photo


Guest
5,410 posts

The <map> tag is supported in all major browsers, according to W3Schools.com. Here is the example from that site for you to compare with yours.

http://www.w3schools.com/tags/tag_map.asp

<img src="planets.gif" width="145" height="126" alt="Planets" usemap="#planetmap" />

<map name="planetmap">
<area shape="rect" coords="0,0,82,126" href="sun.htm" alt="Sun" />
<area shape="circle" coords="90,58,3" href="mercur.htm" alt="Mercury" />
<area shape="circle" coords="124,58,8" href="venus.htm" alt="Venus" />
</map>


CC has a nifty app for creating image maps visually. Give it a try. :)

http://www.coffeecup.com/image-mapper/
CoffeeCup... Yeah, they are the best!
User 81823 Photo


Registered User
52 posts

Tom - do you EVER take time off to sleep?

One step ahead this time - CC's Image Mapper is what I used. And very good it is too!

The example is identical to mine except that after the 'href' element I have added the onclick ref.
The href is only referencing '#' so that it does nothing. The onclick is calling a function.

<area name="blue2_BLOB" shape="poly" coords="182,71,188,75,188,78,174,85,173,81,177,72,184,72" href="#" onclick="changeCOLOUR('89a8e0')" alt="" title="">

As I said it works fine in IE8 - guess for now I will have to code with IE in mind until I can find a solution.

Thanks,
Neil.
User 364143 Photo


Guest
5,410 posts

LOL, Yes I sleep, just don't have a life when I'm awake. :D

Just Googled this;

I found that

<input type="button" value="Submit" onclick="raiseEvent('SubmitForm','');"/>

works in Firefox and IE, but not Google Chrome. However, if you modify it to......

<input type="button" value="Submit" onclick="raiseEvent('SubmitForm','',this);"/>


Modifying the onclick by adding ,this may help.

Found it here http://www.google.com/support/forum/p/Chrome/thread?tid=01dc4261f9ea0bdc&hl=en

And people think it's just IE that acts quirky...:P

Hope this helps.
CoffeeCup... Yeah, they are the best!
User 81823 Photo


Registered User
52 posts

That was one of the solutions I looked at, though it works fine in IE it still does not work in Chrome.

Anyhoo... I will keep coding with IE as browser of choice - my site is nowhere near finished yet, I still have time to work something out.

I will keep searching.

Thanks,
Neil.
User 364143 Photo


Guest
5,410 posts

You would think all the major browsers would get their act together. Very frustrating, indeed. :/
CoffeeCup... Yeah, they are the best!
User 81823 Photo


Registered User
52 posts

Very true Tom and it maybe just something I am overlooking.

I always 'try my luck' with code that I am not familiar with to see what happens. I find it the best way to learn new things rather than keep asking questions (unless I have no choice!)

I will keep playing around with the onclick event and see what happens.

Neil.
User 2073490 Photo


Registered User
154 posts

I have no idea what "onclick" means, but I just sent all my pages through validation, and changed my html pages out with the html Tidy code.
The Tidy thing did resolve some issues that I had, but now my image map looks like a purple corpse- completely dead!
Works fine in Firefox. Anyone wanna take a peek?

http://massagefrog.com/what_hurts.html

I'm going to look at the link Tom posted, earlier to see if I can even read the info there!
Thanks!
User 2073490 Photo


Registered User
154 posts

I spoke too soon! My image map is no longer working in Firefox, either.
I am backing away from this for a while so that I don't have to replace my laptop, after I throw it in the creek behind our house. Geez.
User 184085 Photo


Ambassador
1,707 posts

doctype??
Volunteering to help :)
http://www.tbaygeek.ca
My HTML play area
http://www.tbaygeek.ca/test/

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.