求各位帮忙看看,这段代码可以怎么修改
jquery吧
全部回复
仅看楼主
level 1
胡永宁1992 楼主
<script>
$(document).ready(function() {
$("td").css({"vertical-align":"middle"});
$("button").css({"width":"80px"});
//定义三个标识变量
var sign = "fi",
type = "",
index = 1;
$(".startupall").on('click', function(){
type = "startupall";
process($("#setTaskSize_"+sign+"_"+index));
});
$("li").on('click', 'a', function(){
sign = $(this).attr("sign");
});
$("#_iframe").on('load', function () {
if(type == "startupall") {
$("#lasttd_"+sign+"_"+index).html('<font color="green">启动完毕</font>');
if(index <= $(".setTaskSize:visible").length) {
index = parseInt(index) + 1;
process($("#setTaskSize_"+sign+"_"+index));
}
else {
alert("启动完毕");
}
}else if(type == "startup") {
//alert("#lasttd_"+sign+"_"+index);
$("#lasttd_"+sign+"_"+index).html('<font color="green">执行完毕</font>');
}else if(type == "shutdown") {
$("#lasttd_"+sign+"_"+index).html('<font color="green">关闭完毕</font>');
}
});
$(".startup").on('click', function(){
type = "startup";
var id = $(this).parent().parent().parent().children("td:last-child").attr("id");
index = id.substring(id.lastIndexOf('_') + 1, id.length);
$("#lasttd_"+sign+"_"+index).html('<font color="green">正在执行...</font>');
});
$(".shutdown").on('click', function(){
type = "shutdown";
var id = $(this).parent().parent().parent().children("td:last-child").attr("id");
index = id.substring(id.lastIndexOf('_') + 1, id.length);
});
});
function process(item) {
var $this = $(item);
setTimeout(function(){
$this.submit();
}, 1000);
}
</script>
公司一位人看了之后说代码编写错误,没有面向对象编程,怎么怎么的,请帮看看怎么样修改最好,还有就是从哪找比较好的jquery代码阅读呢,看网上各种风格都有。都要晕了
2017年01月25日 09点01分 1
1