[thelist] javascript / document.write / include javascript

Bob Meetin bobm at dottedi.biz
Thu Aug 9 11:18:01 CDT 2012


Thanks Brian and everyone,

I googled first to get some background, but yes this worked as:

      document.write("<SCR"+"ipt src='$path/the_javascript_file.js'><\/SCR"+"ipt>");

-Bob


On 08/09/2012 07:33 AM, Brian Cummiskey wrote:
> Hey Bob,
> you'll need to split the keyword, ie,
>
> document.write("<scr"+"ipt type .....
>
> you've probably seen this 100 times before and never realized why :)
>
> On Thu, Aug 9, 2012 at 9: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
>> --


More information about the thelist mailing list