<body>
<script>
function addScript(url) {
var xmlhttp;
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
};
};
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
xmlhttp = new XMLHttpRequest();
};
xmlhttp.open('GET', url, false);
xmlhttp.send(null);
if (navigator.appName=="Microsoft Internet Explorer") {
var ifr = document.createElement('iframe');
document.body.appendChild(ifr);
ifr.document.write("<script>"+xmlhttp.responseText+"<\/script>");
document.body.removeChild(ifr);
} else {
var obj = document.createElement('script');
var textScr = document.createTextNode(xmlhttp.responseText);
document.body.appendChild(obj);
obj.appendChild(textScr);
};
};
addScript('script.js');
some_func();
</script>
<button onclick="some_func()">Click ME!!!</button>
</body> |