Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

onClick, onMouseover, onMouseout Together!

Status
Not open for further replies.

danhodges99

IS-IT--Management
Feb 6, 2003
21
GB
Hey guys, I'm designing a site. I can get these commands to work, but never all together! Eg I wish to have a blue button to start with, which changes red onMouseover, then changes to a new button when clicked, then back to the original. Any Ideas?
Much appreciated.
 
make sure they are seperated as such

onmouseover="whatever"; onmouseout="whatever"; onmouseup="whatever"

[Hammer]
Nike Failed Slogans -- "Just Don't Do It!"
 
Huh? They belong all together in the first place.
 
ignore my post

i was breaking up multiple of one instance

[Hammer]
Nike Failed Slogans -- "Just Don't Do It!"
 
<input type=&quot;button&quot; onclick=&quot;&quot; onmouseover=&quot;this.style.background='#f00'&quot; onmouseout=&quot;this.style.background='#00f'&quot; />

I'm not sure what you mean by a new button...
 
oh, I forgot, start blue

<input type=&quot;button&quot; onclick=&quot;&quot; onmouseover=&quot;this.style.background='#f00'&quot; onmouseout=&quot;this.style.background='#00f'&quot; style=&quot;background:#00f;&quot; />
 
CSS 2 is perfect for exactly this using its
a.hover, a.link, a.visited and a.active
tags. It was designed for exactly that purpose, uses
much less code (its defined once on the page and
then reused), and in my opinion is much easier
to maintain. If you want to change a color, for
example, you change it in the style definition,
and thats it. All the tags that use that style are
automatically updated. There is a thread in the HTML/CSS
group that explains this in great detail already:

thread215-521311

I hope that helps. I know it's made my job much easier!
MG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top