Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Oct 2004
    Posts
    592
    Thanks
    0
    Thanked 1 Time in 1 Post

    OnMouseOver- button color change-

    Hi master,

    Let me know a correct coding of OnMouseOver and OnMouseOut button color change.
    Thank you so much.

  • #2
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    Heres something really simple:
    Code:
    <html>
    <head>
    <style type="text/css">
    	#button1 {
    	     color:red;
    	     background:white;
    	 }
    	 #button2 {
    	 	 color:white;
    	 	 background:red;
    	 }
    </style>
    </head>
    <body>
    <form>
    <input type="button" id="button1" value="Button" onmouseover="document.forms[0].button1.id='button2'" onmouseout="document.forms[0].button1.id='button1'"><br><br>
    <input type="button" id="button2" value="Button" onmouseover="document.forms[0].button2.id='button1'" onmouseout="document.forms[0].button2.id='button2'"><br><br>
    </form>
    </body>
    </html>

  • #3
    Senior Coder Mhtml's Avatar
    Join Date
    Jun 2002
    Location
    Sydney, Australia
    Posts
    3,531
    Thanks
    0
    Thanked 1 Time in 1 Post
    Code:
    <input type="submit" onmouseover="this.style.background='red'" onmouseover="this.style.background=''"/>
    Of course you could also just use CSS:
    Code:
    input:hover {
       background: red;
    }
    But that isn't going to work in all browsers.

    [edit:] I don't think that changing the id is such a good idea, changing the class maybe but not the id. What if you are running another script using the id? They might behave incorrectly. However I am definitely not a JS guru.
    Last edited by Mhtml; 01-28-2005 at 05:31 AM.
    Omnis mico antequam dominus Spookster!

  • #4
    Registered User
    Join Date
    Oct 2004
    Posts
    592
    Thanks
    0
    Thanked 1 Time in 1 Post

    Javascript Version

    I would like to know the Current Javascript Version.
    Microsoft Window SP2 said IE support JS version 1.3
    I've heard of Javascript Version 1.5
    Thanks again.

  • #5
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    Quote Originally Posted by Mhtml
    [edit:] I don't think that changing the id is such a good idea, changing the class maybe but not the id. What if you are running another script using the id? They might behave incorrectly. However I am definitely not a JS guru.
    Err I think your right. I obviously wasn't thinking completley when I posted it. Good eye.


  •  

    Posting Permissions

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