[Javascript] Javascript to change include filename
Peter Brunone
peter at brunone.com
Wed Jan 21 12:55:42 CST 2009
As I recall, server-side includes are processed before the language parser
takes over, so even server-side code can't make this dynamic.
However, if you just want to rotate content in a div, you should be able to
do it all in Javascript without an SSI; just pick the file and shove it in
there. You can use an iframe, or an AJAX call, or whatever works best for
you.
Cheers,
Peter
----------------------------------------
From: "Del Wegener" del at delweg.com
Subject: [Javascript] Javascript to change include filename
Good Day;
One of my websites currently contains the following div
My client wants to have 12 - 20 different pic_ordernn files. A random
number generator should be use decide which file to include (pic1.txt,
pic2.txt, pic3.txt, ..., or pic15.txt).
I can write code to randomly create/select one of the filenames but how do
I
insert that filename in the above include statement?
It seems to me the include is serverside and my JS is client side.
Can that filename be a variable whose value is determined when the page is
loaded?
Is this a PHP job?
Thanks for all your suggestions.
Del
More information about the Javascript
mailing list