Closed Thread Icon

Preserved Topic: its me again (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=8066" title="Pages that link to Preserved Topic: its me again (Page 1 of 1)" rel="nofollow" >Preserved Topic: its me again <span class="small">(Page 1 of 1)</span>\

 
bussman
Obsessive-Compulsive (I) Inmate

From: the land of oz
Insane since: Jan 2002

posted posted 02-03-2002 23:23

Hi Everybody,
it's me again! I wrote the following script to scroll a background layer..... so please tell me why the direction of the scroll doesn't change... I can't finde the error!

var id;
var direc="";

function Glide() {
if (ie) {
checkdirec();
if (direc="left") {document.all.landscape.style.pixelLeft -= 10;}
else if (direc="right") {document.all.landscape.style.pixelLeft += 10;}
window.clearInterval(id);
id = window.setInterval("Glide()",30);
}
function checkdirec() {
if (ie) {
if (document.all.landscape.style.pixelLeft<=-1800) {direc="right";}
else if (document.all.landscape.style.pixelLeft>=0) {direc="left";}
}}


Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 02-03-2002 23:44

if (direc="left") should be if(direc=="left") Same with the other if statement.

The equals sign assigns the value on the right to the variable on the left, and then returns the new value of the variable. In this case, it assigns "left" to the variable direc, and then returns the string "left", which, since it's not the empty string or "0", is true.

The double equals compares the two things, and if they're equal, returns true.

bussman
Obsessive-Compulsive (I) Inmate

From: the land of oz
Insane since: Jan 2002

posted posted 02-04-2002 01:06

THX alot slime!
This forum is so cool.....
Thank you all very much!!
cya bussman

Ensabanur
Bipolar (III) Inmate

From: KY
Insane since: Nov 2001

posted posted 02-04-2002 03:42

If I have an If statement that looks like this
_________
if (d=="l")
{
if (currentPos >= x)
{
document.all.container.style.pixelLeft -= 10;
}
else document.all.container.style.pixelLeft = x;
}
_______

shouldn't it stop the layer being moved once it equals x?

Ensa



[This message has been edited by Ensabanur (edited 02-04-2002).]

« BackwardsOnwards »

Show Forum Drop Down Menu