<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>test.worker</title>
</head>
<body>
<script type="text/javascript">
function loadScript(url,callback){
var script = document.createElement("script");
script.type = "text/javascript";
script.src = url;
if (script.readyState){//IE
script.onreadystatechange = function(){
if (script.readyState == "loaded" || script.readyState == "complete"){
script.onreadystatechange = null;
eval(callback + '()');
}
};
} else { //Others: Firefox, Safari, Chrome, and Opera
script.onload = function(){
eval(callback + '()');
};
}
document.body.appendChild(script);
}
</script>
<a href="javascript:loadScript('abc.js','abc');" class="btn ps-cs6">按钮</a>
</body>
</html>
abc.js的文件
function abc(){
alert(new Date());
}
欢迎联系本站长QQ:3216572