Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Need some help with onMouseUp

  1. #1
    Join Date
    Jan 2005
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Need some help with onMouseUp

    Script: CSS Menu highlight
    http://www.dynamicdrive.com/dynamici...shighlight.htm

    Is there any way I could get the table cells to stay the mouseover color once clicked on with this script? Also how would I target a frame?

    Any help is appreciated.
    Nec

  2. #2
    Join Date
    Jan 2005
    Posts
    40
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    To target frames, change

    <a href="http://www.urlgoeshere.com" class="menulink" class=&{ns4class};>

    to

    To target frames, change

    <a href="http://www.urlgoeshere.com" target="YOU_FRAME_NAME" class="menulink" class=&{ns4class};>

    Why would you need cells to stay with the same color if the page will be refreshed anyway and it will get reset?

  3. #3
    Join Date
    Dec 2004
    Posts
    177
    Thanks
    0
    Thanked 18 Times in 17 Posts

    Default

    *sigh*

    FPit...the reason he would want to is obvious. The page isn't being reset. He's using frames, remember? Only the target frame will be reset, and guess what? The target frame is probably not the one with the nav.

  4. #4
    Join Date
    Dec 2004
    Posts
    177
    Thanks
    0
    Thanked 18 Times in 17 Posts

    Default

    Anywho, you can add this right underneath where it says var ns4class=''

    Code:
    var selected=0
    
    function color(num){
     var name="link"
     var el=""
     if (document.getElementById(name+selected)){
      name="link"+selected
      el=document.getElementById(name)
      if (el.className=="menulinked") el.className="menulink"
     }
     name="link"+num
     el=document.getElementById(name) 
     el.className="menulinked"
     selected=num
    }
    Then, in the links themselves, add id="link1" for the first link (duh). Then, add onClick="color(1)" for the first link...like so:
    Code:
    <a href="./myPage.html" target="myFrame" id="link1" onClick="color(1)">Click ME!</a>
    <a href="./myPage.html" target="myFrame" id="link2" onClick="color(2)">Click ME!</a>
    Obviously, you'll have some other stuff in there as well (class names and such. keep them intact.)

    Finally, create a CSS class called menulinked and set it up how you want...(underneath a.menulink:hover{})

    Code:
    .menulinked {
    display: block;
    width: 198px;
    text-align: left;
    text-decoration: none;
    font-family:arial;
    font-size:12px;
    color: #000000;
    border: solid 1px #6100C1;
    background-color:#F0E1FF;
    }

  5. #5
    Join Date
    Jan 2005
    Posts
    40
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Haha, I failed to connect the two together, my bad, brain glitch...

  6. #6
    Join Date
    Jan 2005
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanx for the help.
    But now the cell only stays highlighted until the next link is clicked.

    Nec
    Last edited by Necrin; 01-13-2005 at 01:20 PM.

  7. #7
    Join Date
    Dec 2004
    Posts
    177
    Thanks
    0
    Thanked 18 Times in 17 Posts

    Default

    rofl, Now I'm the one who missed something...I assumed that was the effect you were looking for?

    Please describe this a little better, and I'll fix it, lol....

  8. #8
    Join Date
    Jan 2005
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I would like them to stay that way once clicked on untill the page is refreshed or reopened. As it is now it works, but not the way I'd like it to.

    Nec

  9. #9
    Join Date
    Jan 2005
    Location
    San Francisco
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Are you talking about the cell staying highlighted the way a visited link would function?

  10. #10
    Join Date
    Jan 2005
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Yes, but resetting when refreshed.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •