Faqts : Computers : Programming : Shopping For You : JavaScript

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

11 of 23 people (48%) answered Yes
Recently 4 of 10 people (40%) answered Yes

Entry

How can I embed a .js file inside a .js file when using document.write() method for Netscape browser

Apr 5th, 2008 19:14
ha mo, Colin Fraser, Vishesh Saharawat,


YOur original question does not appear to be very clear but I am
positive that you cannot write anything to a *.js file from a user's
browser.  You can use a javascript to set to a cookie but not what you
seem to want to do. 
What you may be wanting to try is to set a *.js file according to the
browser used. This should be simple : 
<script> <!--
switch (navigator.appname)
    case "Netscape" : 
        document.write("<head>")
        document.write("<link src='netscape.js' type='text/javascript'">
        document.write("<link src='netscape.css' type='text/css'">
        break;  
    case "Microsoft" : 
        document.write("<head>")
        document.write("<link src='msoft.js' type='text/javascript'">
        document.write("<link src='msoft.css' type='text/css'">
        break;
    default : 
        document.write("<head>")
        document.write("<link src='common.css' type='text/css'">       
        document.write("<link src='common.js' type='text/javascript'">
}     -->
</script> 
<title = "A Variable Page">
</head> 
<body>   
In doing this you are varing the possible ways in which the page is
displayed optimizing the styles and scripts for each browser. A lot of
work though.
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