By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,847 Members | 2,296 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,847 IT Pros & Developers. It's quick & easy.

Can a div be the used for onClick

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a

"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

P: n/a
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.