|
-
Mar 11th, 2002, 08:27 AM
#1
Thread Starter
Hyperactive Member
Image swap???
I want to make an image swap.
I have a link, on this links onmouseover and onmouseout i want to change a image. How can i do this???
/Smirre
Visual Basic
C, C++
Java
Access
SQL Server
MCP, MCSD
-
Mar 11th, 2002, 08:45 AM
#2
Fanatic Member
onmouseover="pic('button','pic-off.gif')"
onmouseout="pic('button','pic-on.gif')"
I think thats how its done
-
Mar 11th, 2002, 09:45 AM
#3
Thread Starter
Hyperactive Member
I have used this code to change the image:
document.images['imagename'].src = image1.src;
the image1 is created like this:
image1 = new Image;
image1.src = "grahpics/imagename.gif";
is this syntax correct or???
coudnt the documnet.images be set to the image1 object instead of the src of both objects??? or???
/Smirre
Visual Basic
C, C++
Java
Access
SQL Server
MCP, MCSD
-
Mar 11th, 2002, 09:48 AM
#4
Fanatic Member
Sorry thats gone over my head a bit .. What are you trying to do it in? JavaScript, XML or what?
-
Mar 11th, 2002, 09:50 AM
#5
Thread Starter
Hyperactive Member
Visual Basic
C, C++
Java
Access
SQL Server
MCP, MCSD
-
Mar 11th, 2002, 10:09 AM
#6
Fanatic Member
You dont really have to use document.images, you can still use document.all or getElementById. Try this (edited from the code I posted for you this morning)...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
<script language="JavaScript" type="text/javascript">
<!--
function changeImage(objectID,imageName){
findDom(objectID).src = imageName;
}
function findDom(objectID){
if (document.all){
return document.all(objectID);
} else if (document.getElementById){
return document.getElementById(objectID);
}
}
//-->
</script>
</head>
<body>
<img id="img1" src="image1.jpg" onmouseover="changeImage('img1','image1-2.jpg')" onmouseout="changeImage('img1','image1.jpg')">
</body>
</html>
-
Mar 11th, 2002, 10:41 AM
#7
Fanatic Member
Or if you are using Dreamweaver you can do it in the Rollover Image section..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|