homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

Selecting different include file for each page load

 6:29 am on Jan 5, 2007 (gmt 0)

I need a simple javascript to display a different '.inc' files each time page loads like www.sun.com..
As per my site structure i can't use document.write in js..
I have these images in different .inc files so I need the script which will display different ‘inc’ file every time the page loads.
(simple ad rotator javascript is not working for me – which is for images only not for inc files)
my req is same like sun.com..where u also have next and back buttons to scroll through the images (in my case inc files)..

thanks a lot!



 6:00 pm on Jan 5, 2007 (gmt 0)

These are server side include files?


 8:08 am on Jan 8, 2007 (gmt 0)

This is a classic vanilla implementation of AJAX. Choose the .inc file name randomly from an array of choices. Then load the .inc file with an XMLHttpRequest. Insert the contents of that file onto your page. There are a kajillion tutorials online to teach you how to do this; find one and have fun!

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved