PDA

View Full Version : Blending Image Slide Show & Chrome...



IlanD
08-07-2010, 09:05 AM
1) Script Title: Blending Image Slide Show-no chrome.

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex14/image4.htm

3) Describe problem: I'm using the script on www.pastoralia.co.il index page. when I use Chrome and the page loads as index.htm default page of the website, the page dosn't load and stops at the slideshow. the css validats well but the html has the onload <body> tag problem and two more problems related to the slide show js. the intresting point is that if I load the index page from a inside the website it loads fine and the slidshow runs well?! what am I missing?
Iland

jscheuer1
08-08-2010, 04:36 PM
You left out the closing HTML comment delimiter in the second script for the slide show (opening delimiter highlighted, missing closing delimiter inserted - highlighted and red):


<script type="text/javascript" language="JavaScript1.1">
<!--

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

// -->
</script>

However, it's safest to get rid of all such opening and closing HTML comment delimiters in all script and style blocks. They are no longer needed to 'hide from older browsers' (these older browsers just aren't around any longer) and could potentially get your styles and/or scripts ignored by some newer browsers.

IlanD
08-09-2010, 06:09 PM
Thanks, it works!
I don't understand why... but it works!

jscheuer1
08-09-2010, 06:42 PM
It works because once you have an opening HTML comment delimiter:


<!--

unless or until there is a closing one:


-->

the browser 'is within its rights' to ignore all that follows as a comment.

Most browsers these days will error correct that if you open a comment in a script tag and neglect to close it before the end of the tag, apparently not Chrome.

However, with browsers continually updating, there will come a time when perhaps all that is within these delimiters will be ignored (that's their strict meaning, regardless of where they appear). If so, older scripts like this one that use them will be ignored by those browsers unless both the opening and closing delimiters are removed (well really just the opening ones, but then there is no need for the closing ones).