[thelist] javascript / document.write / include javascript

Simon MacDonald simonmacdonald at uk2.net
Thu Aug 9 09:26:44 CDT 2012


Bob,

you could use jquery to read the javascript file contents  and then output
the file code surrounded  by script tags - I think that is what you are
trying to do?

See:
http://stackoverflow.com/questions/6269159/read-from-textfile-on-server-usin
g-jquery  this just shows the read

there may be another better way but this springs to mind first off ;)

Shout again if you need further clarification

Simon


-----Original Message-----
From: thelist-bounces at lists.evolt.org
[mailto:thelist-bounces at lists.evolt.org] On Behalf Of Bob Meetin
Sent: 09 August 2012 14:23
To: thelist at lists.evolt.org
Subject: [thelist] javascript / document.write / include javascript

Is there a way to include a javascript document, i.e. javascript.js, within
a page if you are using javascript to define some matching criteria?

<script type="text/javascript">
   if( matches_some_mobile_criteria )
   {
      document.write("<script type='text/javascript;
src='javascript.js'></script>");
   }
</script>

If I do it as above it outputs document.write, script type=, etc, rather
than including the .js file.

  Bob
-- 

* * Please support the community that supports you.  * *
http://evolt.org/help_support_evolt/

For unsubscribe and other options, including the Tip Harvester and archives
of thelist go to: http://lists.evolt.org Workers of the Web, evolt ! 



More information about the thelist mailing list