mport.js
========================================
复制内容到剪贴板
代码:
<!--
(function(){
if(typeof window._Import != "undefined") return; //防止多次加载
function _Import(uri, x) {
var f = arguments.callee.caller;
if(typeof f == "function") {
var IsIE = (navigator.userAgent.indexOf("MSIE") == -1)? false : true;
var scriptEle = document.getElementsByTagName("head")[0].appendChild(document.createElement("script"));
scriptEle.type = "text/javascript";
scriptEle.src = uri;
if (x)
{
if (IsIE) {
scriptEle.onreadystatechange = x;
}
else {
scriptEle.onload = x;
}
}
}
}
window._Import = _Import;
})();
//-->
a.js
========================================
复制内容到剪贴板
代码:
var a = "abcdefg===";
调用
========================================
复制内容到剪贴板
代码:
<html>
<head>
<title>-</title>
</head>
<body>
<script type="text/javascript" src="Import.js"></script>
<script type="text/javascript">
(function(){
function callback()
{
if(/loaded/.test(this.readyState))
{
alert(a);
}
}
_Import("http://www.17benteng.com/Codes/Import/a.js", callback)
})()
</script>
</body></html>
演示
========================================
http://17benteng.com/Codes/Import/a.html
复制内容到剪贴板
代码:
<html>
<head>
<title>-</title>
</head>
<body>
<script type="text/javascript" src="Codes/Import/Import.js"></script>
<script type="text/javascript">
(function(){
function callback()
{
if(/loaded/.test(this.readyState))
{
alert(a);
}
}
_Import("Codes/Import/a.js", callback)
})()
</script>
</body></html>
http://www.im286.com/viewthread. ... mp;highlight=import |