PDA

View Full Version : Using Image Conveyor in external ajax pages



malloc1024
08-29-2007, 05:03 PM
Script Title: Conveyor Belt Slideshow
Original URL: http://www.dynamicdrive.com/dynamicindex14/leftrightslide.htm

Modified Code: Was modified for dynamic resize, see attached.

Problem: When using ajax to load another html page where this JS file gets called nothing shows up. Works when directly opening the external page, just not when the external page is embeded. Also tried putting the code directly into the html of the external page, same results. Conveyor works on main page if it is not loaded dynamically with the ajax scripts. You may also want to take a look at http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm
for the ajax scripts being used. Can anyone point me in the right direction?

Thanks

malloc1024
08-31-2007, 04:46 PM
I've tried a fresh copy of the conveyor script in an external page loaded by the ajax script, and all I get then is a blank grey box in the upper left corner of the window, roughly the size of the intended conveyor. No images load, and there isn't even the blank/broken image graphic. Any Help?

jscheuer1
08-31-2007, 05:03 PM
The easiest method is to have the external page with the script on it in an iframe and have Ajax load the page with that iframe.

malloc1024
08-31-2007, 05:22 PM
Actually I thought of that, but when I tried that I cannot then load something in the other ajax divs by clicking on something in the iframe. Of course I'm not sure if I messed something up there or not.
I've continued testing the conveyor script and it seems like it bombs out because of the document.write command. Is there any way to do inline insertion without document.write? I did find this: http://www.sitepoint.com/blogs/2007/07/11/insert-in-place-without-documentwrite/
but I'll admit, that is a bit over my head.

jscheuer1
08-31-2007, 06:15 PM
when I tried that I cannot then load something in the other ajax divs by clicking on something in the iframe

Why not? You would have to use the 'parent.' prefix when calling a function from the top page. Like if you were used to having:


dothis('item2');

Since it is now in an iframe, you need to have:


parent.dothis('item2');

malloc1024
08-31-2007, 06:31 PM
Yep I forgot the "parent" in the javascript... Thanks, I appreciate the help.