jquery与java_纯javascript和jquery实现增删改查

姓名

*

电子邮件

*

网址

价格

你的评论

*

姓名电子邮件网址你的评论价格编辑删除

总价0

$(document).ready(function(){

//  $("#commentForm").validate({meta: "validate"});

$("#commentForm").hide();

$("#add").bind("click",function(){

if($("#commentForm").is(":visible")){

$("#commentForm").hide();

}else{

$("#commentForm").show();

}

})

var num = 1;

$(".submit").click(function(){

$("#commentForm").hide();

var name = $('#cusername').val();

var email = $('#cemail').val();

var url = $('#curl').val();

var price = $('#cprice').val();

var comment = $('#ccomment').val();

var tr = $('

'+name+''+email+''+url+''+comment+''+price+' 编辑 删除');

$('tbody tr:eq(0)').after(tr);

num++;

});

$(".quxiao").click(function(){

$("#commentForm").hide();

});

$('.delete').live('click',function(){

$(this).parent().parent().remove();

});

$('.edit').live('click',function(){

var tr=$(this).parent().parent();

var name = tr.children('.jsname').text();

var email = tr.children('.jsemail').text();

var url = tr.children('.jsurl').text();

var comment = tr.children('.jscomment').text();

var price = tr.children('.jsprice').text();

$('#cusername').attr('value',name);

$('#cemail').attr('value',email);

$('#curl').attr('value',url);

$('#cprice').attr('value',price);

$('#ccomment').attr('value',comment);

$("#commentForm").show();

$(this).parent().parent().remove();

});

$('.deleteall').click(function(){

$('input[type="checkbox"]:checked').each(function(){

$(this).parent().parent().remove();

});

});

var a = true;

$("#CheckedAll").click(function(){

//所有checkbox跟着全选的checkbox走。

if(a){

$('input[type="checkbox"]:checkbox').attr("checked", true);

a = false;

}else {

$('input[type="checkbox"]:checkbox').attr("checked", false);

a=true;

}

});

$("#CheckedRev").click(function(){

$('input[type="checkbox"]:checkbox').each(function(){

this.checked=!this.checked;

});

});

});

posted on 2013-08-16 16:27 杨军威 阅读(342) 评论(0)  编辑  收藏

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值