<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);
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> |