手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >jquery动态加载js三种方法实例
jquery动态加载js三种方法实例
摘要:复制代码代码如下:jquery动态加载js三种方法//方法一$.getscript("test.js");//方法二functionload...

复制代码 代码如下:

<!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>

【jquery动态加载js三种方法实例】相关文章:

jQuery实现给页面换肤的方法

JQuery实现动态添加删除评论的方法

JQuery中Text方法用法实例分析

JS动态增删表格行的方法

jQuery聚合函数实例

原生JS和JQuery动态添加、删除表格行的方法

JQuery分屏指示器图片轮换效果实例

jQuery插件制作之全局函数用法实例

JQuery中节点遍历方法实例

JQuery控制Radio选中方法分析

精品推荐
分类导航