欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jquery動態(tài)加載js三種方法實例

 更新時間:2013年08月03日 10:18:01   作者:  
這里為你提供了三種動態(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="網(wǎng)頁特效">
$.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>

相關(guān)文章

最新評論