简体   繁体   中英

Why isn't my rollover image working?

I have a code for my site, when an image is clicked a pop up window displays which is working fine. However, whenever I roll over the first rollover works, but the original image before the rollover does not show anymore? why is this?

 <input name="image" type="image" onMouseOver= src="http://japanesefriend.zxq.net/images/x11_title.gif" onMouseOut= src="http://japanesefriend.zxq.net/images/level4_nouns_08.gif'"  value="Place Order" src="http://japanesefriend.zxq.net/images/level4_nouns_08.gif" onClick='styledPopupOpen("<img src=http://japanesefriend.zxq.net/flashcards/go.gif />")'  align=middle width=164 height=154>

使用CSS精灵进行过渡。

Your HTML is invalid.

This...

onMouseOver= src="http://japanesefriend.zxq.net/images/x11_title.gif"

should be this...

onMouseOver="this.src='http://japanesefriend.zxq.net/images/x11_title.gif'"

Same for the onMouseOut ...

onMouseOut="this.src='http://japanesefriend.zxq.net/images/level4_nouns_08.gif'"

DEMO: http://jsfiddle.net/XBLfN/


Or you can eliminate this. and just do src='http://...

onMouseOver="src='http://japanesefriend.zxq.net/images/x11_title.gif'"
onMouseOut="src='http://japanesefriend.zxq.net/images/level4_nouns_08.gif'"

DEMO: http://jsfiddle.net/XBLfN/1/

see: rollover image with buttons

this seems to be a duplicate - the solution in the above question shoudl work for you.

For chrome (and even for other browsers), it is always a good idea to validate your html: http://validator.w3.org/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM