jQuery回发问题 [英] Jquery post back issue
本文介绍了jQuery回发问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个有10行的表,并有一个按钮.
我必须第一次隐藏除"firts"行之外的所有行.
当我单击该按钮时,必须显示每一行.
我编写了如下代码
I have a table which have 10 rows and there is a button.
i have to hide all rows except the firts row, for the first time.
and when i click on that button each row has to be displayed.
i have written the code as follows
i = 1;
$(document).ready(function () {
$('#Tr2').hide();
$('#Tr3').hide();
$('#Tr4').hide();
$('#Tr5').hide();
$('#Tr6').hide();
$('#Tr7').hide();
$('#Tr8').hide();
$('#Tr9').hide();
$('#Tr10').hide();
});
$('#NewRecord').click(function () {
if ($.cookie('Value') == null) {
jQuery.cookie('Value', 1);
}
else {
i = parseInt(jQuery.cookie('Value'));
}
i = i + 1;
jQuery.cookie('Value', i);
if (i >= 2) {
$('#Tr2').show();
}
else {
$('#Tr2').hide();
}
if (i >= 3) {
$('#Tr3').show();
}
else {
$('#Tr3').hide();
}
if (i >= 4) {
$('#Tr4').show();
}
else {
$('#Tr4').hide();
}
if (i >= 5) {
$('#Tr5').show();
}
else {
$('#Tr5').hide();
}
if (i >= 6) {
$('#Tr6').show();
}
else {
$('#Tr6').hide();
}
if (i >= 7) {
$('#Tr7').show();
}
else {
$('#Tr7').hide();
}
if (i == 8) {
$('#Tr8').show();
}
else {
$('#Tr8').hide();
}
});
其中Tr2 ... Tr10是行ID.
但是它不能正常工作
where Tr2...Tr10 are the row id''s.
But it is not working properly
推荐答案
(document).ready(function(){
(document).ready(function () {
(#Tr2').hide();
('#Tr2').hide();
(#Tr3').hide();
('#Tr3').hide();
这篇关于jQuery回发问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文