Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Selecting different include file for each page load



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

10+ Year Member

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)

WebmasterWorld Senior Member korkus2000 is a WebmasterWorld Top Contributor of All Time 10+ Year Member

These are server side include files?


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

WebmasterWorld Administrator httpwebwitch is a WebmasterWorld Top Contributor of All Time 10+ Year Member

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!

Featured Threads

Hot Threads This Week

Hot Threads This Month