[thelist] javascript / document.write / include javascript

erik mattheis gozz at gozz.com
Thu Aug 9 11:03:33 CDT 2012


<script id="conditionalInclude">
if (true) {
 var js = document.createElement('script');
 js.src = "test.js";
 document.getElementById('conditionalInclude').insertBefore(js);
}
</script>

On Thu, Aug 9, 2012 at 8:23 AM, Bob Meetin <bobm at dottedi.biz> wrote:

> 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/<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 !




-- 
Erik Mattheis

http://www.flickr.com/gelk


More information about the thelist mailing list