<head>
<script language="JavaScript">
<!--
// PRELOADING IMAGES
if (document.images) {
img_on =new Image(); img_on.src ="../PICS/sparkles.gif";
}
function handleOver() {
if (document.images) document.imgName.src=img_on.src;
}
//-->
</script>
</head>
<body>
<a href="index.php" onMouseOver="handleOver();return true;" target="_parent">Home</a><br/>
</body>
What am I doing wrong? I want my text to have the sparkles image (transparent) show up on top of my text whenever someone hovers over it. Here is my site so you can see it's doing nothing. http://www.starlilycoco.com/
Copyright © 2024 QUIZLS.COM - All rights reserved.
Answers & Comments
Verified answer
Just FYI, I can't reach your site by following the link you provided. Firefox tells me that it "can't find the server at 66.135.37.5%207." Interestingly, %20 is the escape code for a space, meaning the browser is interpreting the site's IP address "66.135.27.5 7". You may want to fix that.
Furthermore, when I try the site at 66.135.27.57, it throws me to a "Default Web Site Page", meaning if you intended to set something up so it shows your page, you haven't done it correctly.
Also, based on what the code looks like, what you're trying to do is not what the code is trying to do. The code you have requires that there already be an image, so that when the user mouses over it, it will change to a second image. It will not work with a text link.
Do note that you could easily emulate this function with CSS instead of JavaScript. For instance:
<html>
<head>
<style type="text/css">
a.sparkle { }
a.sparkle:hover {
background: url('../pics/sparkle.gif');
}
</style>
</head>
<body>
<a href="index.php" class="sparkle">Home</a>
<br />
</body>
</html>
Of course, you'll have to make some adjustments because the text background may be smaller than what you want it to be.