faqts : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

9 of 16 people (56%) answered Yes
Recently 6 of 10 people (60%) answered Yes

Entry

Any way to do this: document.getElementsByTagName('head')[0].appendChild('myScript.js'); in NN4?

Apr 6th, 2008 18:51
ha mo, Jean-Bernard Valentaten, Colin Fraser, Mark Filipak,


> While the method is supported in NN6 and IE5.x I doubt it is supported
> in NN4. Many DOM methods are not supported in pre-v6 in NN
Colin is right about that, but there is another possibility. It's a
trick often used when adding banners and ifs-tags in ilayers and so on.
If you don't mind having ugly looking code, you can do the following.
Inside the head-tag, include this:
<script language="JavaScript">
document.write('<scr' + 'ipt language="JavaScr' + 'ipt"
type="text/javascr' + 'ipt" src="whereeveryourscriptis.js">');
</script>
This will add the script to your page. Be careful when using this. every
time the word script is in your text, you need to split it, so that the
browser won't mess up.
HTH
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com