[thelist] using javascript to create an include?

AtdtXav atdtxav at yahoo.com
Thu Jan 3 01:25:44 CST 2002


Thanks for the suggestion, it definitely sounds like something
that would work.  I could run my test for the week, and for x
week run a script called, say, article12.js that included the
article in javascript format.

I'll give this a try.  Thank you!

Scott

--- Keith <cache at dowebs.com> wrote:
> > what I want to do is create a javascript that says "if it is
> > this particular day, load this html".  I would do this in an
> > include, since we're talking an article here, but of course
> an
> > include is server side and javascript is client-side.
> 
> I use javascript includes, they're called client side
> includes. For the 
> scenario you describe place something like the following
> script 
> block in your body where you want the include to appear:
> 
> <script>
> if (today is){   // use some method for if today
> document.write('<script src="todays.js"></scr'+'ipt>')
> }
> </script>
> 
> Then on todays.js return a document.write like so
> 
> document.write('The cow'+
> 'jumped over the'+
> 'moon')
> 
> You can nest document.writes in document.writes including a
> write 
> to an external js file. In fact you can nest cgi includes the
> same way, 
> for example:
> 
> <script>
> qs=location.search.substring(1)
> document.write('<script src="some.cgi?'+qs+'"></scr'+'ipt>')
> }
> </script>
> 
> and give the cgi the query string to determine what to return
> as 
> document.write output back to the page as an include. This
> allows a 
> "static" page from serverA to display, as an include, dynamic 
> content from serverB.
> 
> keith
> 
> -- 
> For unsubscribe and other options, including
> the Tip Harvester and archive of TheList go to:
> http://lists.evolt.org Workers of the Web, evolt ! 


__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com




More information about the thelist mailing list