PDA

View Full Version : Depressible Image Link Script



Aragoth
02-06-2008, 09:08 PM
1) Script Title:
Depressible Image Link Script
2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex4/image1.htm
3) Describe problem:
I put the script into the head, and the second part into the body inside of a list, but the images I want to use won't show up. Here is the code:


<html>
<head>
<link rel= "stylesheet" href="css.css">
<script language="javascript1.2">
<!--

/*
Depressible Image Script-
Dynamic Drive (www.dynamicdrive.com)
For full source code, installation instructions,
100's more DHTML scripts, and Terms Of
Use, visit dynamicdrive.com
*/

img1=new Image()
img1.src="up1.gif"
img2=new Image()
img2.src="down1.gif"
//-->
</script>

</head>

<body>
<!-- Site navigation menu -->
<ul class="navbar">
<li>Movies In:</li>
<li<a href="2008.html" onMousedown="document.images['example'].src=img2.src" onMouseup="document.images['example'].src=img1.src">
<img src="up1.gif" name="example" border=0></a>
</a>

The image doesn't load even though both of the image files are named correctly and within the same folder. Can anyone please tell what stupid mistake I'm making?

jscheuer1
02-07-2008, 03:02 AM
What you have in your post here:


<li<a href="2008.html" onMousedown="document.images['example'].src=img2.src" onMouseup="document.images['example'].src=img1.src">
<img src="up1.gif" name="example" border=0></a>
</a>

is sloppy coding. There is no link because the opening li tag isn't closed, it lacks a >, and (less important) the li tag itself has no closing tag. It should look like so:


<li><a href="2008.html" onMousedown="document.images['example'].src=img2.src" onMouseup="document.images['example'].src=img1.src">
<img src="up1.gif" name="example" border=0></a>
</li>

There could also be other problems.