blob: 407b31e5fedf7f914d4cc1a10a7f3371357a94aa [file] [log] [blame]
<html>
<head>
<script type="text/javascript">
function log(number)
{
var item = document.createElement("li");
item.appendChild(document.createTextNode("Loaded script " + number + "."));
document.getElementById("console").appendChild(item);
}
function test1()
{
var oHead = document.getElementsByTagName('head')[0];
var oScript = document.createElement('script');
oScript.setAttribute('type', 'text/javascript');
oHead.appendChild(oScript);
oScript.text = 'log("1"); test2();';
}
function test2()
{
var oHead = document.getElementsByTagName('head')[0];
var oScript = document.createElement('script');
oScript.setAttribute('type', 'text/javascript');
oHead.appendChild(oScript);
oScript.innerText = 'log("2"); test3();';
}
function test3()
{
var oScript = document.createElement('SCRIPT');
var oHead = document.getElementsByTagName('HEAD')[0];
oScript.setAttribute('type', 'text/javascript');
oScript.setAttribute('src', 'resources/script3.js');
oHead.appendChild(oScript);
}
function test4()
{
var oScript = document.createElement('SCRIPT');
var oHead = document.getElementsByTagName('HEAD')[0];
oScript.language = 'javascript';
oScript.src = 'resources/script4.js';
oHead.appendChild(oScript);
}
function test5()
{
var oScript = document.createElement('script');
var oBody = document.getElementsByTagName('body')[0];
oScript.setAttribute('type', 'text/javascript');
oScript.setAttribute('src', 'resources/script5.js');
oBody.appendChild(oScript);
}
function test()
{
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
test1();
}
</script>
</head>
<body onload="test()">
<p>This tests 5 different ways of dynamically loading a script by creating a script element.</p>
<p>If it works you should see 5 messages below about successfully loading a script.</p>
<hr>
<p><ol id="console"></ol></p>
</body>
</html>