三种动态加载js的jquery实例代码另附去除js方法
更新时间:2014年04月30日 11:22:59 作者:
这篇文章主要介绍了三种动态加载js的jquery实例代码另附去除js方法,需要的朋友可以参考下
复制代码 代码如下:
!-- 这里为你提供了三种动态加载js的jquery实例代码哦,由于jquery是为用户提供方便的,所以利用jquery动态加载文件只要一句话$.getscript("test.js");就ok了。
<!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>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<title>jquery 动态加载js三种方法</title>
<script language="网页特效">
$.getscript("test.js");
//方法二
function loadjs(file){
var head = $('head').remove('#loadscript');
$("<scri"+"pt>"+"</scr"+"ipt>").attr({src:file,type:'text/javascript',id:'load'}).appendto(head);
}
//够简单把!如果在浓缩以下你甚至可以用一行代码全部搞定:
//方法三
$("<scri"+"pt>"+"</scr"+"ipt>").attr({src:file,type:'text/javascript',id:'load'}).appendto($('head').remove('#loadscript'));
</script>
</head>
<body>
</body>
</html>
jquery去除js
复制代码 代码如下:
$("script[src='../static/js/cpu_memory.js']").remove();
$("script[src='../static/js/wan_flow.js']").remove();
相关文章
JavaScript使用Math.Min返回两个数中较小数的方法
这篇文章主要介绍了JavaScript使用Math.Min返回两个数中较小数的方法,涉及javascript中Math.Min方法的使用技巧,非常具有实用价值,需要的朋友可以参考下2015-04-04
javascript支持firefox,ie7页面布局拖拽效果代码
javascript 拖拽 页面拖拽 拖拽效果的页面 超级拖拽 javascript支持firefox,ie7页面布局拖拽效果代码 鼠标拖拽2007-12-12
element中el-switch的v-model自定义值的实现
在el-switch中设置active-value和inactive-value属性,接受Boolean, String或Number类型的值,本文就来介绍一下element中el-switch的v-model自定义值的实现,感兴趣的可以了解一下2023-11-11


最新评论