js实现不重复导入的方法

本文实例讲述了js实现不重复导入的方法。分享给大家供大家参考,具体如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>无标题页</title> <mce:script src="https://www.jb51.net/jquery-1.4.4.js" mce_src="https://www.jb51.net/jquery-1.4.4.js" type="text/javascript"></mce:script> <mce:script type="text/javascript"><!-- function importOnce(scriptPath) { var scripts = document.getElementsByTagName("script"); for (var index = 0; index < scripts.length; index++) { if (scripts[index].src.lastIndexOf(scriptPath) != -1) { return; } } var scriptTag = document.createElement("script"); scriptTag.type = "text/javascript"; scriptTag.src = scriptPath; var headTag = document.getElementsByTagName("head")[0]; headTag.appendChild(scriptTag); } importOnce("https://www.jb51.net/jquery-1.4.4.js"); importOnce("https://www.jb51.net/jquery-1.4.4.js"); importOnce("jquery-1.4.3.js"); importOnce("jquery-1.4.3.js"); // --></mce:script> </head> <body> </body> </html>

更多关于JavaScript相关内容感兴趣的读者可查看本站专题:《JavaScript查找算法技巧总结》、《JavaScript动画特效与技巧汇总》、《JavaScript错误与调试技巧总结》、《JavaScript数据结构与算法技巧总结》、《JavaScript遍历算法与技巧总结》及《JavaScript数学运算用法总结

希望本文所述对大家JavaScript程序设计有所帮助。

您可能感兴趣的文章:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wgyxfw.html