PDA

View Full Version : Errors on page with slideshow script



maffpunton
08-02-2005, 04:59 PM
Hi!

I have a slideshow script at the following url:

http://www.opusexpo.co.uk/hayleyneil/projects/ariel/index.htm

The slideshow seems to be working fine but Internet Explorer says there is an error on the page? Any ideas of what it is?

Please help!

Thanks

Matthew

jscheuer1
08-02-2005, 05:21 PM
No error here, what version IE are you using?

Twey
08-02-2005, 05:58 PM
Click the little error sign in the corner for more details on the error.

maffpunton
08-02-2005, 06:22 PM
Hi!

my ie version is 6.0.2900.2180.

The error comes up as:

Line: 60
Char: 1
Error: Object required
Code: 0
URL: http://www.opusexpo.co.uk/hayleyneil/projects/ariel/index.htm

Very frustrating!

jscheuer1
08-02-2005, 06:32 PM
Still no error here, I have the same version, possibly with a later service pak. When and where does the error occur? Does it happen when viewing the page online or just locally? Does it happen when the page loads or after you interact with it in some way, what way?

maffpunton
08-02-2005, 06:37 PM
It occurs online and locally (although obviously a local url is displayed in the error message for local access) and the error displays immediately when the page is loaded.

jscheuer1
08-02-2005, 07:24 PM
Does it happen when you click on the link to it from your post? Not here but, if I go 'home' and hit back or navigate to it from within your site, I do get the error. It is not on line 60 of the page itself though, if you add blank lines at the top it is still line 60. This means it is in one of the linked files, probably a script. To find which one, put all the external scripts right on the page. Then the error should point to the actual line, or as often is the case with script errors, the line after the problem.

maffpunton
08-02-2005, 08:04 PM
Okay, i've put the new url at:

http://www.opusexpo.co.uk/hayleyneil/projects/ariel/test.htm

and it shows the error as line 417, char 1. I still dont see the problem, though i;m not particularly good at javascript.

Any ideas?

jscheuer1
08-02-2005, 09:03 PM
That did it! Find this function (it's in the ariel_slideshow.js):


function getpos(){
leftpos=(detectexist(window.screenLeft))? screenLeft+document.body.clientWidth/2-popwidth/2 : detectexist(window.screenX)? screenX+innerWidth/2-popwidth/2 : 0
toppos=(detectexist(window.screenTop))? screenTop+document.body.clientHeight/2-popheight/2 : detectexist(window.screenY)? screenY+innerHeight/2-popheight/2 : 0
if (window.opera){
leftpos-=screenLeft
toppos-=screenTop
}
}
replace it with this one:

function getpos(){
leftpos=(detectexist(window.screenLeft))? screenLeft+document.documentElement.clientWidth/2-popwidth/2 : detectexist(window.screenX)? screenX+innerWidth/2-popwidth/2 : 0
toppos=(detectexist(window.screenTop))? screenTop+document.documentElement.clientHeight/2-popheight/2 : detectexist(window.screenY)? screenY+innerHeight/2-popheight/2 : 0
if (window.opera){
leftpos-=screenLeft
toppos-=screenTop
}
}That will take care of that error. Others may present themselves but, let's worry about that if it happens.

jscheuer1
08-02-2005, 09:51 PM
I played around with that script some more and like this variation much better. It centers the popups horizontally and sizes the popup window to the picture. (just replace from the start here to the end of the original script):


//do NOT edit pass this line

////center popup code////////////

function detectexist(obj){
return (typeof obj !="undefined")
}

function getpos(){
leftpos=(detectexist(window.screenLeft))? screenLeft+document.documentElement.clientWidth/2-popwidth/2 : detectexist(window.screenX)? screenX+innerWidth/2-popwidth/2 : 0
toppos=(detectexist(window.screenTop))? screenTop+document.documentElement.clientHeight/2-popheight/2 : detectexist(window.screenY)? screenY+innerHeight/2-popheight/2 : 0
if (window.opera){
leftpos-=screenLeft
toppos-=screenTop
}
}

getpos()
var winattributes='width='+popwidth+',height='+popheight+',resizable=yes,left='+leftpos+',top='+toppos

/////end center popup code///////

var preloadedimages=new Array()
for (i=0;i<photos.length;i++){
preloadedimages[i]=new Image()
preloadedimages[i].src=photos[i]
}
var preloadedlinks=new Array()
for (i=0;i<photoslink.length;i++){
preloadedlinks[i]=new Image()
preloadedlinks[i].src=photoslink[i]


}


function applyeffect(){
if (document.all && photoslider.filters){
photoslider.filters.revealTrans.Transition=Math.floor(Math.random()*23)
photoslider.filters.revealTrans.stop()
photoslider.filters.revealTrans.apply()
}
}



function playeffect(){
if (document.all && photoslider.filters)
photoslider.filters.revealTrans.play()
}

function keeptrack(){
window.status="Image "+(which+1)+" of "+photos.length
}


function backward(){
if (which>0){
which--
applyeffect()
document.images.photoslider.src=photos[which]
playeffect()
keeptrack()
}
}

function forward(){
if (which<photos.length-1){
which++
applyeffect()
document.images.photoslider.src=photos[which]
playeffect()
keeptrack()
}
}

function transport(){
if (!window.opera){
leftpos=(detectexist(window.screenLeft))? screenLeft+document.documentElement.offsetWidth/2-Math.floor((preloadedlinks[which].width+20)/2) : detectexist(window.screenX)? screenX+innerWidth/2-Math.floor((preloadedlinks[which].width+20)/2) : 0
winattributes='width='+(preloadedlinks[which].width+20)+',height='+(preloadedlinks[which].height+20)+',resizable=yes,left='+leftpos+',top='+toppos
}
window.open(photoslink[which],"",winattributes)
}

maffpunton
08-02-2005, 09:58 PM
Wow! You're a genius!

Thank you SO much. That's worked a treat!

Thanks again,

matthew