三種動態(tài)加載js的jquery實例代碼另附去除js方法
更新時間:2014年04月30日 11:22:59 作者:
這篇文章主要介紹了三種動態(tài)加載js的jquery實例代碼另附去除js方法,需要的朋友可以參考下
復制代碼 代碼如下:
!-- 這里為你提供了三種動態(tài)加載js的jquery實例代碼哦,由于jquery是為用戶提供方便的,所以利用jquery動態(tài)加載文件只要一句話$.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 動態(tài)加載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();
您可能感興趣的文章:
- 使用jQuery動態(tài)加載js腳本文件的方法
- jquery及js實現(xiàn)動態(tài)加載js文件的方法
- jquery getScript動態(tài)加載JS方法改進詳解
- 一個簡單的動態(tài)加載js和css的jquery代碼
- 如何使用jquery動態(tài)加載js,css文件實現(xiàn)代碼
- jquery動態(tài)加載js/css文件方法(自寫小函數(shù))
- 使用jquery動態(tài)加載Js文件和Css文件
- 使用jquery動態(tài)加載javascript以減少服務器壓力
- jquery動態(tài)加載js三種方法實例
- 使用jquery動態(tài)加載js文件的方法
- jQuery實現(xiàn)動態(tài)加載(按需加載)javascript文件的方法分析
相關文章
JavaScript 輪播圖和自定義滾動條配合鼠標滾輪分享代碼貼
本文給大家分享一段js輪播圖和自定義滾動條的代碼片段,布局和樣式小編沒給大家多介紹,大家可以根據(jù)個人需求優(yōu)化,具體實現(xiàn)代碼,大家可以參考下面代碼片段2016-10-10