jQuery 正確的書寫格式
引入
html寫法
<html>
<head>
<meta http
<title></title>
<script src="modules
<script>
$(function() {
qiyiPlugin
});
</script>
</head>
<div id="zong_qiyi">
//XXXXXXXXXXXXXX
</div>
jQuery寫法
var qiyiPlugin =
{
init: function(parentNode) {
var self = this;
self
//刷新局部內容
self
self
});
}
//顯示
qiyiList: function(){
var self = this;
//顯示內功信息
self
//console
if(result
self
self
}else{
alert("沒有獲得奇藝數據
}
});
}
//顯示奇藝內容
displayQiyiList: function(qiyiList){
var self = this;
var top = "#zong_qiyi";
$(top)
if ($(this)
});
var line
$
var line
$(line
$(line
$(line
$(line
$(line
$(line
$(line
$(line
$(line
$(line
var table = $(this)
var info = $(table)
self
if(!result
alert(result
}else{
//alert(result
growingPlugin
self
}
});
});
});
}
//賦html值
qiyiHtml
var string = "<table id=
string += "<tr><td>名稱
string += "<tr><td>當前等級
string += "<tr><td>最大等級
string += "<tr><td>exp
string += "<tr><td>描述
string += "<tr><td><button id=
string += "</table>";
$("#zong_qiyi")
}
//奇藝升級
clickToUpgradeQiyi: function(info
var query = "operation=upgradeQiyi";
query += "&qiyiName=" + info
toolsPlugin
}
//獲得奇藝列表
getQiyiList: function(callback) {
var query = "operation=getQiyiList";
toolsPlugin
}
};
From:http://tw.wingwit.com/Article/program/Java/JSP/201311/20658.html