468,306 Members | 1,243 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,306 developers. It's quick & easy.

Can a div be the used for onClick

I inherited a site written with <layer> tags for 4.79. I want to update
it for Mozilla but am having .js problems. Changing the layers to divs
will be easy but one problem is that the site is written so that
clicking on a layer fires off some javascript that changes the
appearance of other layers. I can do the appearance/disappearance part,
but I can not figure out how to make a div such that clicking anywhere
on it will trigger javascript.

Suggestions and comments welcome.

The site is on an intranet and is not accessible from the world.
--
bill
Technical Service Systems
bill (atsign) TechServSys (period) com

unix is user friendly, it is just careful who it befriends

Jul 20 '05 #1
2 131263

"bill" <no****@spamcop.net> wrote in message
news:vn************@corp.supernews.com...
I can not figure out how to make a div such that clicking anywhere
on it will trigger javascript.


What browser are you using? The code below worked in all the popular
browsers out there...

<div onclick="alert( 'yeah' );"
style="left:50px;top:50px;position:absolute;backgr ound-color:#12d635;width:1
50px;height;450px;">
This is a div
</div>

Is this what you wanted?

Andy
Jul 20 '05 #2
Andrew Tang wrote:
"bill" <no****@spamcop.net> wrote in message
news:vn************@corp.supernews.com...
I can not figure out how to make a div such that clicking anywhere
on it will trigger javascript.
What browser are you using? The code below worked in all the popular
browsers out there...

<div onclick="alert( 'yeah' );"
style="left:50px;top:50px;position:absolute;backgr ound-color:#12d635;width:1
50px;height;450px;">
This is a div
</div>

Is this what you wanted?]


exactly what I wanted, I am using Mozilla 1.5b.

THIS TIME, it works like a charm. I must have had an error in my code
earlier. Thanks a lot !

Andy


--
bill
Technical Service Systems
bill (atsign) TechServSys (period) com

unix is user friendly, it is just careful who it befriends

Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Shock | last post: by
3 posts views Thread by F. Da Costa | last post: by
2 posts views Thread by Andy Goldstein | last post: by
1 post views Thread by Chris Soulsby | last post: by
2 posts views Thread by Peter | last post: by
6 posts views Thread by Nx | last post: by
9 posts views Thread by Donius | last post: by
8 posts views Thread by Dan Rumney | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by Teichintx | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.