PDA

View Full Version : Blending Image Slideshow script error in Opera



mgscom
09-09-2005, 04:31 AM
Hello,
I am new to this forum. First of all, thank Dynamic Drive for those great scripts that have saved us great deal amount of time!!!

I am helping to build an online store but not yet an Javascript expert. We are leveraging the Blending Image Slideshow script, along with others. The script is said to work in Opera 7 (without the blend-in effect of course). But we run into some error in Opera 8.02 complaining about the type. The script works fine with IE6 and Firefox and Netscape as expected. The following is cut & pasted from the Opera 8.02 Javascript console:
Inline script thread
Error:
name: TypeError
message: Statement on line 5: Could not convert undefined or null to object
Backtrace:
Line 5 of inline#8 script in URL removed as requested
var blenddelay = ie ? document.images.slide.filters[0].duration * 1000 : 0;

Does anyone knows why or if this is a bug? Thanks in advance.

Jason

jscheuer1
09-09-2005, 05:30 AM
The problem is that opera reads document.all as true but, doesn't do filter styles. Try changing this line on the page:

var ie=document.all

to

var ie=document.all&&!window.opera

mgscom
09-10-2005, 12:01 AM
Thanks, John. I've tried what you suggested. Same error.

Any further suggestions? or anyone else has any? Thanks.

Jason

jscheuer1
09-10-2005, 06:34 AM
That should have fixed it, that's the difference between just looking at the code and experimenting to see what happens. As it turns out, there is another script linked to the page that redeclares the ie variable as only document.all. Best then to deal with it on just the lines affected:

<script language="JavaScript1.1">
<!--
var whichlink=0
var whichimage=0
var blenddelay=(ie&&!window.opera)? document.images.slide.filters[0].duration*1000 : 0
function slideit(){
if (!document.images) return
if (ie&&!window.opera) document.images.slide.filters[0].apply()
document.images.slide.src=imageholder[whichimage].src
if (ie&&!window.opera) document.images.slide.filters[0].play()
whichlink=whichimage
whichimage=(whichimage<slideimages.length-1)? whichimage+1 : 0
setTimeout("slideit()",slidespeed+blenddelay)
}
slideit()
//-->
</script>

mgscom
09-10-2005, 04:08 PM
Thank you. It worked! Yes, in my particular situation, the value of ie vairable was overwritten by declarations in other places. Otherwise, as you pointed out, changing from "var ie=document.all" (as shown in the original script) to "var ie=document.all&&!window.opera" shoulad have fixed the problem on Opera.

Will this change be made to the original script on http://dynamicdrive.com/dynamicindex14/image4.htm, too? This appears to be a bug on Opera?

Thanks again,
Jason

jscheuer1
09-10-2005, 04:28 PM
That should be done but, I'm not affiliated with Dynamic Drive so, a bug report needs to be made. I think I will.