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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

The Scripting Object Model messes up my javascript 1

Status
Not open for further replies.

bryant89

Programmer
Nov 23, 2000
150
CA
I have this code within an asp page that will not work if the scripting object model is turned on for the page. I need it turned on to use dtc's but I also need it turned off to do this javascript:

<script language=&quot;JavaScript1.1&quot;>
<!--
var image1=new Image()
image1.src=&quot;13-5-1.jpg&quot;
var image2=new Image()
image2.src=&quot;13-5-2.jpg&quot;
var image3=new Image()
image3.src=&quot;13-5-3.jpg&quot;
//-->
</script>
<TITLE></TITLE>
</HEAD>
<BODY onLoad=&quot;slideit()&quot;>
<img src=&quot;13-5-1.jpg&quot; WIDTH=225 HEIGHT=225 name=&quot;slider&quot; border=0 style=&quot;filter:blendTrans(duration=3)&quot;>
<script>
<!--
////change number of images below
var number_of_images=3

//change speed below (in seconds)
var speed=3
var step=1
var whichimage=1

function slideit()
{
if (!document.images)
return

if (document.all)
slider.filters.blendTrans.apply()
document.images.slider.src=eval(&quot;image&quot;+step+&quot;.src&quot;)

if (document.all)
slider.filters.blendTrans.play()
whichimage=step

if (step<number_of_images)
step++
else
step=1

if (document.all)
setTimeout(&quot;slideit()&quot;,speed*1000+3000)
else
setTimeout(&quot;slideit()&quot;,speed*1000)
}

//-->
</script>

I name my image slider and when I go to do something like this: slider.filters.blendTrans.apply() <see code above for line I got this from>

I get an error that says 'slider' is undefined

how can I use this javascript without turning off Scripting Object Model
 
Try addressing the 'slider' entity the same way every time, i.e.:

document.images.slider.src
OR
document.all(&quot;slider&quot;).filters.blendTrans.apply()

Hope this helps
-pete

 
Thank you very much PETE that is awesome. I am sooooo grateful.

You the man.

As you can tell I am happy that it works.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top