Can a div be the used for onClick

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • bill

    #1

    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

  • Andrew Tang

    #2
    Re: Can a div be the used for onClick


    "bill" <nobody@spamcop .net> wrote in message
    news:vn5i7d5jmh 6if5@corp.super news.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:50p x;top:50px;posi tion:absolute;b ackground-color:#12d635;w idth:1
    50px;height;450 px;">
    This is a div
    </div>

    Is this what you wanted?

    Andy


    Comment

    • bill

      #3
      Re: Can a div be the used for onClick

      Andrew Tang wrote:[color=blue]
      > "bill" <nobody@spamcop .net> wrote in message
      > news:vn5i7d5jmh 6if5@corp.super news.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:50p x;top:50px;posi tion:absolute;b ackground-color:#12d635;w idth:1
      > 50px;height;450 px;">
      > 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

      Comment

      Working...