Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 3 of 3

Thread: Button rollover

  1. #1
    Junior Member
    Join Date
    Apr 2003
    Location
    Nowhere, really
    Posts
    1
    Member #
    1081
    I was wondering if 'twould be possible to make some form of script to make ordinary HTML buttons change colour on mouse over. Now, I know I could do it individually for every button, but that would be a tremendous pain.

    My idea was something along the lines of this...
    I have a php layout file included that sets up the layout on very single page, so I thought that I could set up some a loop.. or something.. in that file, to set document.form.button.onmouseover=changecolour(), or something like that anyway.

    Would that be do-able? Or not?

  2.  

  3. #2
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    Untested but try:
    Code:
    <input type="submit" id="testbutton"
        onMouseOver="document.all['id'].style.backgroundColor = 'red'"
        onMouseOut="document.all['id'].style.backgroundColor = ''"
        value="Roll over me">
    That would be IE-only, BTW.
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  4. #3
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    Here's a DOM-compliant version

    Code:
    <input type="submit" id="yo"
        onMouseOver="document.getElementById('yo').style.backgroundColor = 'red'"
        onMouseOut="document.getElementById('yo').style.backgroundColor = ''"
        value="Roll over me">


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 08:00 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2020 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com