HighDots Forums  

Re: Dynamic include files

Javascript JavaScript language (comp.lang.javascript)


Discuss Re: Dynamic include files in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Guido Wesdorp
 
Posts: n/a

Default Re: Dynamic include files - 05-27-2004 , 09:57 AM






Adam wrote:
Quote:
Hi All,

Is it possible to use includes dynamically in html.

....

Quote:
script language="javascript"
function checkFileToInclude(){
if (location.search == "?file1"){
return "<!--#include file='file1.html'-->"
}else{
return "<!--#include file='file2.html'-->"
}
}
/script

Lol not unless this script runs on the server... I assume you want to
perform the actions in the #include statements, and those should be
performed on the server side, since the JavaScript is executed on the
client side the server will never know what process.
The funny thing is that this may actually work, but then the other way
round from what you seem to expect: the server will, *before* sending
the result to the client, replace the SSI instructions with the content
of *both* html files and later on the JavaScript picks one of those to
use...

Cheers,

Guido


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.