Connecting Tech Pros Worldwide Help | Site Map

Can a div be the used for onClick

  #1  
Old July 20th, 2005, 09:21 PM
bill
Guest
 
Posts: 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

  #2  
Old July 20th, 2005, 09:21 PM
Andrew Tang
Guest
 
Posts: n/a

re: Can a div be the used for onClick



"bill" <nobody@spamcop.net> wrote in message
news:vn5i7d5jmh6if5@corp.supernews.com...
I can not figure out how to make a div such that clicking anywhere[color=blue]
> on it will trigger javascript.
>[/color]

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


  #3  
Old July 20th, 2005, 09:22 PM
bill
Guest
 
Posts: n/a

re: Can a div be the used for onClick


Andrew Tang wrote:[color=blue]
> "bill" <nobody@spamcop.net> wrote in message
> news:vn5i7d5jmh6if5@corp.supernews.com...
> I can not figure out how to make a div such that clicking anywhere
>[color=green]
>>on it will trigger javascript.
>>[/color]
>
>
> 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?][/color]

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 !
[color=blue]
>
> Andy
>
>[/color]

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

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

Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
can Accordion menu can be used in a " for loop" or not? bhavyagupt answers 3 September 29th, 2008 02:24 AM
Link two dropdowns so the second dropdown can use sql query zion4ever answers 4 August 13th, 2008 01:31 AM
Problem in Event Handling sorobor answers 2 July 11th, 2007 01:01 PM
problem walking thru a collection of SPANS children of a DIV Joseph answers 8 July 23rd, 2005 07:42 PM