Log in

View Full Version : Image Change using mouseover



jmevz
07-24-2011, 06:44 AM
Hi All,

Please take a look at: http://cgi.ebay.com/vtg-70s-CROCHET-LACE-cutout-bell-ANGEL-slv-MINI-dress-/220816257889?_trksid=p4340.m185&_trkparms=algo%3DSIC.OPJS%26its%3DI%26itu%3DUA%26otn%3D5%26pmod%3D370526314673%26ps%3D63%26clkid%3D1513153295183762099#ht_1870wt_1219

I have no knowledge of Javascript but am good with HTML and some basic PHP. I am designing a similar eBay page and the customer wants an image change on mouse over similar to the link above. How can I achieve this without having code in the head section of the page as eBay forbids.

I was hoping someone could point me to an open source script or a free script that I could implement easily enough? I did find one on DD, but it requires head content and calls a script file...

Anyone?
Thanks,
Jeff.

vwphillips
07-24-2011, 07:54 AM
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<title></title>
</head>

<body>
<img src="http://www.vicsjavascripts.org.uk/StdImages/Egypt5.jpg"
onmouseover="this.src='http://www.vicsjavascripts.org.uk/StdImages/Egypt6.jpg';"
onmouseout="this.src='http://www.vicsjavascripts.org.uk/StdImages/Egypt5.jpg';"
/>
</body>

</html>

djr33
07-24-2011, 02:37 PM
The code above should work fine. Generally, you can place anything from the head section into the body section within script tags and it will function similarly. It may not be the "best" way to do it (and it may not always work) but when you can't use the head section, it's a viable work around in many cases. I don't remember if ebay allows <script> tags at all though so that's important to check. But you can get around the head issue in most cases.