PDA

View Full Version : Flying images aren't flying



jkimbro01
08-23-2007, 09:30 PM
1) Script Title: Floating Images Script

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex4/flyimage.htm

3) Describe problem: Hey all,,,, don't look now but here's another newbie problem!
The floating images script is killin' me.
I'm changing the parts that it says to change,,i.e name of the picture file.

<A HREF="http://dynamicdrive.com"><IMG SRC="test.gif" BORDER=0></a>
</DIV>

Here are my questions:
The picture is in the same folder as the htm file,,do I need the <A HREF= ?stuff or can that line just start with the <IMG etc...?

Then, is there anything in the "moveobj.js" file that needs to be changed?
The directions don't say to but I'm running out of reasons for this thing not to work for me.
Thanks,,Jerry

jscheuer1
08-24-2007, 09:05 AM
You can remove:


<A HREF="http://dynamicdrive.com"> . . . </a>

from the markup, but you need to keep the rest, ex:


<div id="flyimage2" style="position:absolute;left:-500px;width:47;height:68;">
<img src="test.gif" border="0">
</div>

The script itself doesn't need to be changed.

jkimbro01
08-26-2007, 03:52 PM
Well,,,tried that but still no go. Here's what I'm using, (below), I have the .js file & beeback.gif in the same folder. What am I missing? The error I get is Line 22 character 2 chip is undefined. Thanks for the help



<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>

<script type="text/javascript" src="moveobj.js"> </script>
<script type="text/javascript">

/***********************************************
* Floating image script- By Virtual_Max (http://www.geocities.com/siliconvalley/lakes/8620)
* Modified by Dynamic Drive for various improvements
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

//Step 1: Define unique variable names depending on number of flying images (ie:3):
var flyimage1, flyimage2, flyimage3

function pagestart(){
//Step 2: Using the same variable names as 1), add or delete more of the below lines (60=width, height=80 of image):
flyimage1=new Chip("flyimage1",47,68);
flyimage2=new Chip("flyimage2",47,68);
flyimage3=new Chip("flyimage3",47,68);


//Step 3: Using the same variable names as 1), add or delete more of the below lines:
movechip("flyimage1");
movechip("flyimage2");
movechip("flyimage3");

}

if (window.addEventListener)
window.addEventListener("load", pagestart, false)
else if (window.attachEvent)
window.attachEvent("onload", pagestart)
else if (document.getElementById)
window.onload=pagestart

</script>
</head>

<body>
<!-- Step 4: Define your flying images. For each image's ID tag, use the same variable names as 1) above -->

<DIV ID="flyimage1" STYLE="position:absolute; left: -500px; width:47; height:68;">
<img src="beeback.gif" border="0">
</DIV>
<DIV ID="flyimage2" STYLE="position:absolute; left: -500px; width:47; height:68;">
<img src="beeback.gif" border="0">
</DIV>
<DIV ID="flyimage3" STYLE="position:absolute; left: -500px; width:47; height:68;">
<img src="beeback.gif" border="0">
</DIV>

</body>

</html>

jscheuer1
08-26-2007, 09:31 PM
Works fine here:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript" src="moveobj.js"> </script>
<script type="text/javascript">

/***********************************************
* Floating image script- By Virtual_Max (http://www.geocities.com/siliconvalley/lakes/8620)
* Modified by Dynamic Drive for various improvements
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

//Step 1: Define unique variable names depending on number of flying images (ie:3):
var flyimage1, flyimage2, flyimage3

function pagestart(){
//Step 2: Using the same variable names as 1), add or delete more of the below lines (60=width, height=80 of image):
flyimage1=new Chip("flyimage1",47,68);
flyimage2=new Chip("flyimage2",47,68);
flyimage3=new Chip("flyimage3",47,68);


//Step 3: Using the same variable names as 1), add or delete more of the below lines:
movechip("flyimage1");
movechip("flyimage2");
movechip("flyimage3");

}

if (window.addEventListener)
window.addEventListener("load", pagestart, false)
else if (window.attachEvent)
window.attachEvent("onload", pagestart)
else if (document.getElementById)
window.onload=pagestart

</script>
</head>
<body>
<!-- Step 4: Define your flying images. For each image's ID tag, use the same variable names as 1) above -->

<div id="flyimage1" style="position:absolute; left: -500px; width:47; height:68;">
<img src="http://www.dynamicdrive.com/ballon4.gif" border=0>
</div>

<div id="flyimage2" style="position:absolute; left: -500px; width:47; height:68;">
<img src="http://www.dynamicdrive.com/ballon2.gif" border=0>
</div>

<div id="flyimage3" style="position:absolute; left: -500px; width:47; height:68;">
<img src="http://www.dynamicdrive.com/ballon3.gif" border=0>
</div>
</body>
</html>