I have a web page that has the following code...
switch (optwizsel)
{
case "YYP":
window.document.write("<scr" + "ipt language='JavaScript' src='setup/alerts/alertwizard1.
js'></scr" + "ipt>");
break;
case "YNP":
window.document.write("<scr" + "ipt language='JavaScript' src='setup/alerts/alertwizard2.
js'></scr" + "ipt>");
break;
case "NYP":
window.document.write("<scr" + "ipt language='JavaScript' src='setup/alerts/alertwizard3.
js'></scr" + "ipt>");
break;
case "NNP":
window.document.write("<scr" + "ipt language='JavaScript' src='setup/alerts/alertwizard4.
js'></scr" + "ipt>");
break;
case "YYY":
window.document.write("<scr" + "ipt language='JavaScript' src='setup/alerts/alertwizard5.
js'></scr" + "ipt>");
break;
case "YNY":
window.document.write("<scr" + "ipt language='JavaScript' src='setup/alerts/alertwizard6.
js'></scr" + "ipt>");
break;
case "NYY":
window.document.write("<scr" + "ipt language='JavaScript' src='setup/alerts/alertwizard7.
js'></scr" + "ipt>");
break;
case "NNY":
window.document.write("<scr" + "ipt language='JavaScript' src='setup/alerts/alertwizard8.
js'></scr" + "ipt>");
break;
case "YYN":
window.document.write("<scr" + "ipt language='JavaScript' src='setup/alerts/alertwizard5.
js'></scr" + "ipt>");
break;
case "YNN":
window.document.write("<scr" + "ipt language='JavaScript' src='setup/alerts/alertwizard6.
js'></scr" + "ipt>");
break;
case "NYN":
window.document.write("<scr" + "ipt language='JavaScript' src='setup/alerts/alertwizard7.
js'></scr" + "ipt>");
break;
case "NNN":
window.document.write("<scr" + "ipt language='JavaScript' src='setup/alerts/alertwizard8.
js'></scr" + "ipt>");
break;
default:
break;
}
Basically all it does is go through a routine of checking a unix server for the config of certain items and based upon that config writes the appropriate statement in the head to assign the correct external
js file.
Here is my question and the advice I am needing...This has the high probability of expanding in the future beyond checking the three config options I am checking today. My concern is complexity and size of the page. Ideally what I would love to do is assign an external
js file that simply does the checking and writes the appropriate code line to assign the correct
js file to the page. Is this possible? Is it possible to have an external
js file that writes to the head an external
js file?
And if anyone has any other ideas, I am open to them.
Clay Hess