Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help with error...

Status
Not open for further replies.

mackey333

Technical User
May 10, 2001
563
US
ok once again I am getting an error that makes no sense to me...this project isn't going very well..can you tell?

here is a part of the code:

Code:
<script language=&quot;javascript&quot;>

function loadDivs1() {	

	distance = 0

	for (i=0; i<83; i++) {
	
	distance++

document.write(&quot;<div align=&quot;center&quot; id=&quot;1divMover&quot; + i + &quot;style=&quot;position: absolute; top: &quot; + distance + &quot;%&quot;/>&quot;);

Code:
	document.write(&quot;<img border=&quot;0&quot; src=&quot;tapdance.gif&quot; width=&quot;30&quot; height=&quot;69&quot;/>&quot;);
	document.write(&quot;</div/>&quot;);
	
	}
	
	document.write(&quot;</td/>&quot;);
	document.write(&quot;</tr/>&quot;);
	document.write(&quot;</table/>&quot;);
	document.write(&quot;</div/>&quot;);

}

function loadDivsSetup() {

	document.write(&quot;<div align=&quot;center&quot; id=&quot;parentDiv&quot; style=&quot;position: relative; background-color: #FFFFFF;  height: 100%; width: 100%&quot;/>&quot;);
	document.write(&quot;<table align=&quot;center&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; width=&quot;100%&quot; height=&quot;100%&quot;/>&quot;);
	document.write(&quot;<tr/>&quot;);
	document.write(&quot;<td/>&quot;);
	
	loadDivs1();
}	
	

var num, countHide, countShow

num = 83
countHide = 1
countShow = 2

function startLoopSet() {

	document.getElementById('divMover' + countHide).style.visibility ='hidden';
	document.getElementById('divMover' + countShow).style.visibility = 'visible';
	
	countHide++
	countShow++
	
	if (countShow != num) {
	
		setTimeout('startLoopSet()', 1)
	}
}
	
loadDivs1();	
	
</script>

this is supposed make a division with a table, then spit out 82 divisions into the table...I get an error (object expected ')' ) on the bold line..I don't know why.

thanks for any help

-Greg
 
You have nested quotes, need to use either single inside double, or escape sequence, this is what you're after:

document.write(&quot;<div align='center' id='1divMover' + i + &quot; style='position: absolute; top: &quot; + distance + &quot;%&quot;'/>&quot;);


or you can use escape &quot; -> \&quot;.

I find it helpful to print out what it looks like in an alert box or something, to make sure of whitespace and quotes.
b2 - benbiddington@surf4nix.com
 
I corrected the JavaScript problems that were causing errors. I noticed a few other problems with the scrip and your html and if you want I can take a closer look at it and give you some suggestions.

[tt]
<script language=&quot;javascript&quot;>

function loadDivs1() {

distance = 0

for (i=0; i<83; i++) {

distance++


//document.write(&quot;<div align=&quot;center&quot; id=&quot;1divMover&quot; + i + &quot;style=&quot;position: absolute; top: &quot; + distance + &quot;%&quot;/>&quot;);
document.write(&quot;<div align=\&quot;center\&quot; id=\&quot;1divMover&quot; + i + &quot;style=\&quot;position: absolute; top: &quot; + distance + &quot;%\&quot;/>&quot;);

//document.write(&quot;<img border=&quot;0&quot; src=&quot;tapdance.gif&quot; width=&quot;30&quot; height=&quot;69&quot;/>&quot;);
document.write(&quot;<img border=\&quot;0\&quot; src=\&quot;tapdance.gif\&quot; width=\&quot;30\&quot; height=\&quot;69\&quot;/>&quot;);
document.write(&quot;</div/>&quot;);

}

document.write(&quot;</td/>&quot;);
document.write(&quot;</tr/>&quot;);
document.write(&quot;</table/>&quot;);
document.write(&quot;</div/>&quot;);

}

function loadDivsSetup() {

//document.write(&quot;<div align=&quot;center&quot; id=&quot;parentDiv&quot; style=&quot;position: relative; background-color: #FFFFFF; height: 100%; width: 100%&quot;/>&quot;);
document.write(&quot;<div align=\&quot;center\&quot; id=\&quot;parentDiv\&quot; style=\&quot;position: relative; background-color: #FFFFFF; height: 100%; width: 100%\&quot;/>&quot;);
//document.write(&quot;<table align=&quot;center&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; width=&quot;100%&quot; height=&quot;100%&quot;/>&quot;);
document.write(&quot;<table align=\&quot;center\&quot; border=\&quot;0\&quot; cellspacing=\&quot;0\&quot; cellpadding=\&quot;0\&quot; width=\&quot;100%\&quot; height=\&quot;100%\&quot;/>&quot;);
document.write(&quot;<tr/>&quot;);
document.write(&quot;<td/>&quot;);

loadDivs1();
}


var num, countHide, countShow

num = 83
countHide = 1
countShow = 2

function startLoopSet() {

document.getElementById('divMover' + countHide).style.visibility ='hidden';
document.getElementById('divMover' + countShow).style.visibility = 'visible';

countHide++
countShow++

if (countShow != num) {

setTimeout('startLoopSet()', 1)
}
}

loadDivs1();

</script>

[/tt]
 
Good boy, you stayed in the lines ;-)
b2 - benbiddington@surf4nix.com
 
ok..thanks...I'll get this done sooner or later...where does everyone get those smilies from?

-Greg
 
ok..here is the new code I get an object required on the bold line..what did I do now?...

Code:
<script language=&quot;javascript&quot;>

function loadDivs1() {	

	distance = 0

	for (i=0; i<83; i++) {
	
		distance++
	
		document.write(&quot;<div align=\&quot;center\&quot; id=\&quot;1divMover&quot; + i + &quot;style=\&quot;position: absolute; top: &quot; + distance + &quot;%\&quot;/>&quot;);

Code:
		document.getElementById('1divMover' + i ).style.visibility ='hidden';

Code:
		document.write(&quot;<img border=\&quot;0\&quot; src=\&quot;tapdance.gif\&quot; width=\&quot;30\&quot; height=\&quot;69\&quot;/>&quot;);    
		document.write(&quot;</div/>&quot;);
	
	}
	
	document.write(&quot;</td/>&quot;);
	document.write(&quot;</tr/>&quot;);
	document.write(&quot;</table/>&quot;);
	document.write(&quot;</div/>&quot;);

}

function loadDivsSetup() {

	document.write(&quot;<div align=\&quot;center\&quot; id=\&quot;parentDiv\&quot; style=\&quot;position: relative; background-color: #FFFFFF;  height: 100%; width: 100%\&quot;/>&quot;);	
	document.write(&quot;<table align=\&quot;center\&quot; border=\&quot;0\&quot; cellspacing=\&quot;0\&quot; cellpadding=\&quot;0\&quot; width=\&quot;100%\&quot; height=\&quot;100%\&quot;/>&quot;);
	document.write(&quot;<tr/>&quot;);
	document.write(&quot;<td/>&quot;);
	
	loadDivs1();
}	
	

var num, countHide, countShow

num = 83
countHide = 1
countShow = 2

function startLoopSet() {

	document.getElementById('1divMover' + countHide).style.visibility ='hidden';
	document.getElementById('1divMover' + countShow).style.visibility = 'visible';
	
	countHide++
	countShow++
	
	if (countShow != num) {
	
		setTimeout('startLoopSet()', 1)
	}
}
	
loadDivs1();	
	


</script>

</head>

<body bgColor=&quot;FF0000&quot; onLoad=&quot;startLoopSet()&quot;>
	
</body>

thanks
-Greg :-Q



 
I also get an object required error in startLoopSet()...the first two commands, they are calling the same thing that was created...right?

-Greg :-Q
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top