姓名
*
电子邮件
*
网址
价格
你的评论
*
姓名电子邮件网址你的评论价格编辑删除
总价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) 编辑 收藏