peelmaster
11-08-2003, 02:31 PM
I'm trying to simply move through a series of images dynamically. The code basically works when I test it locally, but when I upload the file and test it using my browser, I get the lovely error message "Operation is not allowed when the object is closed." The other problem that I am having is that when the user gets to the End of File and clicks next, there seems to be a blank record in between the EOF and BOF. Any help would be appreciated.
Here is the code:
<HTML>
<HEAD>
<OBJECT ID ="teampics" CLASSID ="CLSID:333C7BC4-460F-11D0-BC04-0080C7055A83">
<PARAM NAME = "DataURL" VALUE = "teampics.txt">
<PARAM NAME = "UseHeader" VALUE = "True">
</OBJECT>
<SCRIPT LANGUAGE="JavaScript">
<!--
recordSet = teampics.recordset;
function move( whereTo ) {
switch( whereTo ) {
case "first":
recordSet.MoveFirst();
break;
case "previous":
if ( recordSet.BOF )
recordSet.MoveLast();
else
recordSet.MovePrevious();
break;
case "next":
if ( recordSet.EOF )
recordSet.MoveFirst();
else
recordSet.MoveNext();
break;
case "last":
recordSet.MoveLast();
break;
}
}
// --!>
</SCRIPT>
</HEAD>
<BODY>
<img datasrc="#teampics" datafld="teams">
<INPUT TYPE = "button" VALUE = "First Team" ONCLICK = "move( 'first' );">
<INPUT TYPE = "button" VALUE = "Previous Team" ONCLICK = "move( 'previous' );">
<INPUT TYPE = "button" VALUE = "Next Team" ONCLICK = "move( 'next' );">
<INPUT TYPE = "button" VALUE = "Last Team" ONCLICK = "move( 'last' );">
</BODY>
</HTML>
The teampic.txt file looks like this.
teams
teamphotos/adamsteam.jpg
teamphotos/ballteam.jpg
teamphotos/burgessteam.jpg
teamphotos/chicorliteam.jpg
teamphotos/currieteam.jpg
teamphotos/doranteam.jpg
teamphotos/hacknerteam.jpg
teamphotos/hendersonteam.jpg
teamphotos/langteam.jpg
teamphotos/maletteteam.jpg
teamphotos/pineauteam.jpg
teamphotos/rosengrenteam.jpg
teamphotos/saloteam.jpg
teamphotos/shubatteam.jpg
teamphotos/stewartteam.jpg
teamphotos/weissteam.jpg
Its weird that the code won't work if I refresh the page...that's when I get the error message, but works if I go back and then forward on the browser. ????
Here is the code:
<HTML>
<HEAD>
<OBJECT ID ="teampics" CLASSID ="CLSID:333C7BC4-460F-11D0-BC04-0080C7055A83">
<PARAM NAME = "DataURL" VALUE = "teampics.txt">
<PARAM NAME = "UseHeader" VALUE = "True">
</OBJECT>
<SCRIPT LANGUAGE="JavaScript">
<!--
recordSet = teampics.recordset;
function move( whereTo ) {
switch( whereTo ) {
case "first":
recordSet.MoveFirst();
break;
case "previous":
if ( recordSet.BOF )
recordSet.MoveLast();
else
recordSet.MovePrevious();
break;
case "next":
if ( recordSet.EOF )
recordSet.MoveFirst();
else
recordSet.MoveNext();
break;
case "last":
recordSet.MoveLast();
break;
}
}
// --!>
</SCRIPT>
</HEAD>
<BODY>
<img datasrc="#teampics" datafld="teams">
<INPUT TYPE = "button" VALUE = "First Team" ONCLICK = "move( 'first' );">
<INPUT TYPE = "button" VALUE = "Previous Team" ONCLICK = "move( 'previous' );">
<INPUT TYPE = "button" VALUE = "Next Team" ONCLICK = "move( 'next' );">
<INPUT TYPE = "button" VALUE = "Last Team" ONCLICK = "move( 'last' );">
</BODY>
</HTML>
The teampic.txt file looks like this.
teams
teamphotos/adamsteam.jpg
teamphotos/ballteam.jpg
teamphotos/burgessteam.jpg
teamphotos/chicorliteam.jpg
teamphotos/currieteam.jpg
teamphotos/doranteam.jpg
teamphotos/hacknerteam.jpg
teamphotos/hendersonteam.jpg
teamphotos/langteam.jpg
teamphotos/maletteteam.jpg
teamphotos/pineauteam.jpg
teamphotos/rosengrenteam.jpg
teamphotos/saloteam.jpg
teamphotos/shubatteam.jpg
teamphotos/stewartteam.jpg
teamphotos/weissteam.jpg
Its weird that the code won't work if I refresh the page...that's when I get the error message, but works if I go back and then forward on the browser. ????