I just created my first script. (Based off a tutorial, though) A script used to create rollover effects. And, well, it creates the rollover effects, but it doesn’t remove them when the mouse is moved off the image.
Here’s the code:
[CODE]
<script language=”JavaScript”>
first = new Image
first.src = “/data/images/misc/controls/first.gif”
firsthover = new Image
firsthover.src = “/data/images/misc/controls/firsthover.gif”
previous = new Image
previous.src = “/data/images/misc/controls/previous.gif”
previoushover = new Image
previoushover.src = “/data/images/misc/controls/previoushover.gif”
next = new Image
next.src = “/data/images/misc/controls/next.gif”
nexthover = new Image
nexthover.src = “/data/images/misc/controls/nexthover.gif”
last = new Image
last.src = “/data/images/misc/controls/last.gif”
lasthover = new Image
lasthover.src = “/data/images/misc/controls/lasthover.gif”
function switchimages(imagename, newimage) {
document.images[imagename].src = newimage.src
}
</script>
[code=php]
…
if($currentid != 1) {
$todisplay .= ” <a href=”{$_SERVER[‘PHP_SELF’]}?action=comic&id=1″
onmouseover=”switchimages(‘first’, firsthover)”
onmouseout=”switchimages(‘first’, first)”>
<img name=”first” src=”/data/images/misc/controls/first.gif” width=”32″ height=”32″ alt=”First” />
</a>n”;
} else {
…
I tripple checked if the paths to the .gif files were correct, which was pretty much the only thing I thought that could have been wrong.
If you could offer some suggestions on how to fix this script, it’d be great.
Thanks.