<div id="gag"> positioning & sizing

Discussion in 'JavaScript' started by haipravu, Jul 5, 2007.

  1. #1
    my JavaScript requires my rollover function to be in a
    <div id="gag"> tag.
    i would prefer to use
    <div class="gag"> so i could reference the sizing with CSS
    since i can't... is it possible to describe my size and position with JavaScript?
     
    haipravu, Jul 5, 2007 IP
  2. NoamBarz

    NoamBarz Active Member

    Messages:
    242
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    58
    #2
    Couldn't you use something like <div id="gag" class="gag"> ??

    If not, you could also use <div id="gag" style="....">

    And if that won't work, you can alter the div style as follows:

    document.geElementById("gag").className = "gag";

    or

    document.geElementById("gag").style.color='red'; (for IE)
    document.geElementById("gag").color='red'; (for FF)

    Hope this helps.
     
    NoamBarz, Jul 5, 2007 IP
  3. ajsa52

    ajsa52 Well-Known Member

    Messages:
    3,426
    Likes Received:
    125
    Best Answers:
    0
    Trophy Points:
    160
    #3
    With CSS you can apply rules to "id" and/or to "class". Examples:

    With "id":
    
    <style type="text/css">
    #gagI { ... }
    </style>
    ...
    <div id="gagI" ... >
    
    Code (markup):
    With "class":
    
    <style type="text/css">
    .gagC { ... }
    </style>
    ...
    <div class="gagC" ... >
    
    Code (markup):
     
    ajsa52, Jul 5, 2007 IP