Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
Validating mouseovers
Old 08-04-2008, 06:43 PM Validating mouseovers
Skilled Talker

Posts: 68
Trades: 0
Can anyone tell me the best way to validate a mouseover image. "onload" doesn't validate. When I tried using the a:hover {background-image: url(....);} , it takes too long to load. Any advice?
kayla2 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-04-2008, 10:41 PM Re: Validating mouseovers
serandfae's Avatar
Do the "Evil Nanner" !!!

Posts: 8,936
Name: Tim Daily
Location: Apex, NC, US, Sol 3
Trades: 0
Put this in the head of your page:

Code:
<script language="Javascript" type="text/javascript">
<!-- hide script from old browsers
/*Simple Rollover script*/
	if (document.images) {
	orgimg = new Image
	switchimg = new Image
	orgimg.src = "images/originalimage.jpg"
	switchimg.src = "images/rolloverimage.jpg"
	}
	else {
	orgimg = ""
	switchimg = ""
	document.roll = ""
	}
// end hiding script from old browsers -->
</script>
Then you call the rollover in the link or image like so:

Code:
<a href="*" onmouseover="document.roll.src=switchimg.src" onmouseout="document.roll.src=orgimg.src"></a>
That will work and validate; I use that particular rollover on one of my sites.
tim
__________________
SEO "experts" smell like Big Fish_|_
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

serandfae is offline
Reply With Quote
View Public Profile Visit serandfae's homepage!
 
Old 08-04-2008, 11:22 PM Re: Validating mouseovers
TreyeMe's Avatar
Experienced Talker

Posts: 49
Name: Mike
Location: NY
Trades: 0
I just did this for a page im making accualling
Code:
<a href="link of image here" onmouseover="nameofsourcefilehere.src='url to image for mouse over'" onmouseout="nameofsourcefilehere.src='url to image after your mouse is scrolls over'"><img src="url to image before mouse scrolls" name="nameofsourcefilehere" border="0" /></a>
for an example of this code go http://eveotto.com/test.html

MIND THE MESS OF CODING OR EVEN THE PAGE

I TORE THE WHOLE SITE DOWN AND STARTING OVER -_-

Simple yet valid. enjoy
TreyeMe is offline
Reply With Quote
View Public Profile
 
Old 08-05-2008, 09:57 AM Re: Validating mouseovers
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
I always make rollovers with sprites, which prevents the "flicker" effect you are experiencing as the :hover image loads. http://www.alistapart.com/articles/sprites
__________________
Join me on
Please login or register to view this content. Registration is FREE
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 08-05-2008, 03:43 PM Re: Validating mouseovers
LadynRed's Avatar
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
You should also wrap the scripting inside CDATA so that the validator will ignore it.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Validating mouseovers
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.22302 seconds with 12 queries