jQuery 正确的书写格式:
引入:<script src="/UploadFiles/2021-04-02/jquery.js">html写法:
复制代码 代码如下:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<script src="/UploadFiles/2021-04-02/qiyi.js"><script>
$(function() {
qiyiPlugin.init($("#zong_qiyi"));
});
</script>
</head>
<div id="zong_qiyi">
//XXXXXXXXXXXXXX
</div>
jQuery写法:
var qiyiPlugin =
{
init: function(parentNode) {
var self = this;
self.parentNode = parentNode;
//刷新局部内容
self.parentNode
.on('refresh',function(event){
self.qiyiList();
});
},
//显示
qiyiList: function(){
var self = this;
//显示内功信息
self.getQiyiList(function(result){
//console.log(result);
if(result.qiyiList){
self.qiyiHtml1();//重新覆盖html,防止重复显示内容
self.displayQiyiList(result.qiyiList);//展示页面内容
}else{
alert("没有获得奇艺数据,请查看接口");
}
});
},
//显示奇艺内容
displayQiyiList: function(qiyiList){
var self = this;
var top = "#zong_qiyi";
$(top).find('#qiyi_control_panel').each(function(){
if ($(this).data('data')) $(this).remove();
});
var line0 = $(top).find("#qiyi_control_panel");
$.each(qiyiList,function(index,item2){
var line1 = $(line0).clone();
$(line1).data('data',item2);//附加属性data与信息
$(line1).attr('id',index+1);
$(line1).find("#name").html(item2.name);
$(line1).find("#level").html(item2.level);
$(line1).find("#maxLevel").html(item2.maxLevel);
$(line1).find("#exp").html(item2.exp+"/"+item2.needExp);
$(line1).find("#desc1").html(item2.desc1);
$(line0).before(line1);
$(line1).show();
$(line1).find("#upgrade")
.on('click',function(event){
var table = $(this).parents('table:first');
var info = $(table).data('data');
self.clickToUpgradeQiyi(info, function(result){
if(!result.success){
alert(result.fail.desc1);
}else{
//alert(result.success.desc1);
growingPlugin.playerTopData();//改变attrs属性
self.parentNode.trigger('refresh');
}
});
});
});
},
//赋html值-
qiyiHtml1: function() {
var string = "<table id='qiyi_control_panel' class='table table-bordered table-hover' style='display:none; width:500;'>";
string += "<tr><td>名称:</td><td id=name>haoren_内功</td></tr>";
string += "<tr><td>当前等级:</td><td id=level></td></tr>";
string += "<tr><td>最大等级:</td><td id=maxLevel></td></tr>";
string += "<tr><td>exp:</td><td id=exp></td></tr>";
string += "<tr><td>描述:</td><td id=desc1></td></tr>";
string += "<tr><td><button id='upgrade' class='btn btn-link'>升级</button></td></tr>";
string += "</table>";
$("#zong_qiyi").html(string);
},
//奇艺升级
clickToUpgradeQiyi: function(info,callback) {
var query = "operation=upgradeQiyi";
query += "&qiyiName=" + info.name;
toolsPlugin.play(query,callback);
},
//获得奇艺列表
getQiyiList: function(callback) {
var query = "operation=getQiyiList";
toolsPlugin.play(query,callback);
},
};
引入:<script src="/UploadFiles/2021-04-02/jquery.js">html写法:
复制代码 代码如下:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<script src="/UploadFiles/2021-04-02/qiyi.js"><script>
$(function() {
qiyiPlugin.init($("#zong_qiyi"));
});
</script>
</head>
<div id="zong_qiyi">
//XXXXXXXXXXXXXX
</div>
jQuery写法:
var qiyiPlugin =
{
init: function(parentNode) {
var self = this;
self.parentNode = parentNode;
//刷新局部内容
self.parentNode
.on('refresh',function(event){
self.qiyiList();
});
},
//显示
qiyiList: function(){
var self = this;
//显示内功信息
self.getQiyiList(function(result){
//console.log(result);
if(result.qiyiList){
self.qiyiHtml1();//重新覆盖html,防止重复显示内容
self.displayQiyiList(result.qiyiList);//展示页面内容
}else{
alert("没有获得奇艺数据,请查看接口");
}
});
},
//显示奇艺内容
displayQiyiList: function(qiyiList){
var self = this;
var top = "#zong_qiyi";
$(top).find('#qiyi_control_panel').each(function(){
if ($(this).data('data')) $(this).remove();
});
var line0 = $(top).find("#qiyi_control_panel");
$.each(qiyiList,function(index,item2){
var line1 = $(line0).clone();
$(line1).data('data',item2);//附加属性data与信息
$(line1).attr('id',index+1);
$(line1).find("#name").html(item2.name);
$(line1).find("#level").html(item2.level);
$(line1).find("#maxLevel").html(item2.maxLevel);
$(line1).find("#exp").html(item2.exp+"/"+item2.needExp);
$(line1).find("#desc1").html(item2.desc1);
$(line0).before(line1);
$(line1).show();
$(line1).find("#upgrade")
.on('click',function(event){
var table = $(this).parents('table:first');
var info = $(table).data('data');
self.clickToUpgradeQiyi(info, function(result){
if(!result.success){
alert(result.fail.desc1);
}else{
//alert(result.success.desc1);
growingPlugin.playerTopData();//改变attrs属性
self.parentNode.trigger('refresh');
}
});
});
});
},
//赋html值-
qiyiHtml1: function() {
var string = "<table id='qiyi_control_panel' class='table table-bordered table-hover' style='display:none; width:500;'>";
string += "<tr><td>名称:</td><td id=name>haoren_内功</td></tr>";
string += "<tr><td>当前等级:</td><td id=level></td></tr>";
string += "<tr><td>最大等级:</td><td id=maxLevel></td></tr>";
string += "<tr><td>exp:</td><td id=exp></td></tr>";
string += "<tr><td>描述:</td><td id=desc1></td></tr>";
string += "<tr><td><button id='upgrade' class='btn btn-link'>升级</button></td></tr>";
string += "</table>";
$("#zong_qiyi").html(string);
},
//奇艺升级
clickToUpgradeQiyi: function(info,callback) {
var query = "operation=upgradeQiyi";
query += "&qiyiName=" + info.name;
toolsPlugin.play(query,callback);
},
//获得奇艺列表
getQiyiList: function(callback) {
var query = "operation=getQiyiList";
toolsPlugin.play(query,callback);
},
};
华山资源网 Design By www.eoogi.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
华山资源网 Design By www.eoogi.com
暂无评论...
更新日志
2024年11月18日
2024年11月18日
- 伊能静.1999-从脆弱到勇敢1987-1996精选2CD【华纳】【WAV+CUE】
- 刘亮鹭《汽车DJ玩主》[WAV+CUE][1.1G]
- 张杰《最接近天堂的地方》天娱传媒[WAV+CUE][1.1G]
- 群星《2022年度发烧天碟》无损黑胶碟 2CD[WAV+CUE][1.4G]
- 罗文1983-罗文甄妮-射雕英雄传(纯银AMCD)[WAV+CUE]
- 群星《亚洲故事香港纯弦》雨果UPMAGCD2024[低速原抓WAV+CUE]
- 群星《经典咏流传》限量1:1母盘直刻[低速原抓WAV+CUE]
- 庾澄庆1993《老实情歌》福茂唱片[WAV+CUE][1G]
- 许巍《在别处》美卡首版[WAV+CUE][1G]
- 林子祥《单手拍掌》华纳香港版[WAV+CUE][1G]
- 郑秀文.1997-我们的主题曲【华纳】【WAV+CUE】
- 群星.2001-生命因爱动听电影原创音乐AVCD【MEDIA】【WAV+CUE】
- 林志颖.1994-别了晴雨的回忆【飞碟】【WAV+CUE】
- 群星《经典咏流传2》限量1:1母盘直刻[低速原抓WAV+CUE]
- 【蓝卡唱片】卫海霞《乐海霞音珍藏版》WAV分轨