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
    New Coder
    Join Date
    Nov 2006
    Posts
    94
    Thanks
    0
    Thanked 0 Times in 0 Posts

    button impression onmouseover and onclick

    First off, I know very little javascript. I was wondering how to make a button (an image acting as a link instead of text) impression when the user goes over it and when the user clicks it.

    Any help would be much appreciated.

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    You could try something like this and use background-image instead of background-color, unless you create seperate images for each event

    PHP Code:
    <style type="text/css">
    .
    out{width:100px;border:2px outset white;cursor:hand;cursor:pointer;background-color:#ccddcc}
    .over{width:100px;border:2px groove white;cursor:hand;cursor:pointer;background-color:#ccddcc}
    .down{width:90px;border:2px inset white;cursor:hand;cursor:pointer;background-color:#ccddcc}
    </style>

    <
    div class="out" onmouseover="this.className='over'" onmouseout="this.className='out'" onmousedown="this.className='down'" onmouseup="this.className='over'">Check</div
    The silent one.

    The most dangerous thing in the world is an idea.
    The most dangerous person in the world is the one with an idea.

  • #3
    New Coder
    Join Date
    Nov 2006
    Posts
    94
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I don't want to use css to make the buttons. I have images of buttons, and I decided to get them in two slightly different colors for the onmouseover effect. They will change colors. How do I do this? The simplest way to do this would be appreciated.
    Last edited by phpnewb; 12-21-2006 at 04:00 AM.

  • #4
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Try this

    <img src="image1.jpg" onmouseover="this.src='image2.jpg'" onmouseout="this.src='image1.jpg'">
    The silent one.

    The most dangerous thing in the world is an idea.
    The most dangerous person in the world is the one with an idea.

  • #5
    New Coder
    Join Date
    Nov 2006
    Posts
    94
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok thx


  •  

    Posting Permissions

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