3 <script type=
"text/javascript">
6 var item
= document
.createElement("li");
7 item
.appendChild(document
.createTextNode("Loaded script " + number
+ "."));
8 document
.getElementById("console").appendChild(item
);
12 var oHead
= document
.getElementsByTagName('head')[0];
13 var oScript
= document
.createElement('script');
14 oScript
.setAttribute('type', 'text/javascript');
15 oHead
.appendChild(oScript
);
16 oScript
.text
= 'log("1"); test2();';
20 var oHead
= document
.getElementsByTagName('head')[0];
21 var oScript
= document
.createElement('script');
22 oScript
.setAttribute('type', 'text/javascript');
23 oHead
.appendChild(oScript
);
24 oScript
.innerText
= 'log("2"); test3();';
28 var oScript
= document
.createElement('SCRIPT');
29 var oHead
= document
.getElementsByTagName('HEAD')[0];
30 oScript
.setAttribute('type', 'text/javascript');
31 oScript
.setAttribute('src', 'resources/script3.js');
32 oHead
.appendChild(oScript
);
36 var oScript
= document
.createElement('SCRIPT');
37 var oHead
= document
.getElementsByTagName('HEAD')[0];
38 oScript
.language
= 'javascript';
39 oScript
.src
= 'resources/script4.js';
40 oHead
.appendChild(oScript
);
44 var oScript
= document
.createElement('script');
45 var oBody
= document
.getElementsByTagName('body')[0];
46 oScript
.setAttribute('type', 'text/javascript');
47 oScript
.setAttribute('src', 'resources/script5.js');
48 oBody
.appendChild(oScript
);
52 if (window
.testRunner
) {
53 testRunner
.dumpAsText();
54 testRunner
.waitUntilDone();
61 <body onload=
"test()">
62 <p>This tests
5 different ways of dynamically loading a script by creating a script element.
</p>
63 <p>If it works you should see
5 messages below about successfully loading a script.
</p>
65 <p><ol id=
"console"></ol></p>