使用JQuery 做仿asp.net 中的gridview 控件编辑效果
2012-03-18 11:36
369 查看
<script src="jquery-1.3.1.js" type="text/javascript"></script> //*********导入 JQuery
<script type="text/javascript">
$(document).ready(function(){
//给class为content添加事件
$('.content').bind("click",function(){
$(this).children('.show').hide();
$(this).children('.input').show();
$(this).next().children('input:eq(1)').removeAttr("disabled");
});
//给按两个钮添加事件
$('.content').next().children().bind("click",function rev(){
var $a=$(this) ;
if($a.val()=="取消")
{
$a.parent().prev().children('.show').show();
$a.parent().prev().children('.input').hide();
$a.next().attr("disabled","disabled");
}
if($a.val()=="修改")
{
alert ($a.parent().prev().children('.input').children('input').val());
// 是用Ajax 进行交互 提交数据
}
});
})
</script>
</head>
<body>
<table width="418" border="0">
<tr>
<td colspan="3" bgcolor="#333333">新闻种类编辑</td>
</tr>
<tr>
<td width="62">编号</td>
<td width="213" align="center">内容</td>
<td width="129" align="center">编辑</td>
</tr>
<tr>
<td width="62">1</td>
<td width="213" class="content"><div class="show" >军事新闻</div><div class="input" style="display:none;"> <input type="text" value="军事新闻"/></div></td>
<td width="129" id="edit">
<input id="Button1" type="button" value="取消" /> <input id="Button2" type="button" value="修改" disabled="disabled"/>
</td>
</tr>
<tr>
<td width="62">2</td>
<td width="213" class="content"><div class="show" >国际新闻</div><div class="input" style="display:none;"> <input type="text" value="国际新闻"/></div></td>
<td width="129" id="Td1">
<input id="Button3" type="button" value="取消" /> <input id="Button4" type="button" value="修改" disabled="disabled"/>
</td>
</tr>
<tr>
<td width="62">3</td>
<td width="213" class="content"><div class="show" >国内新闻</div><div class="input" style="display:none;"> <input type="text" value="国内新闻"/></div></td>
<td width="129" id="Td2">
<input id="Button5" type="button" value="取消" /> <input id="Button6" type="button" value="修改" disabled="disabled"/>
</td>
</tr>
</table>
</body>
</html>
<script type="text/javascript">
$(document).ready(function(){
//给class为content添加事件
$('.content').bind("click",function(){
$(this).children('.show').hide();
$(this).children('.input').show();
$(this).next().children('input:eq(1)').removeAttr("disabled");
});
//给按两个钮添加事件
$('.content').next().children().bind("click",function rev(){
var $a=$(this) ;
if($a.val()=="取消")
{
$a.parent().prev().children('.show').show();
$a.parent().prev().children('.input').hide();
$a.next().attr("disabled","disabled");
}
if($a.val()=="修改")
{
alert ($a.parent().prev().children('.input').children('input').val());
// 是用Ajax 进行交互 提交数据
}
});
})
</script>
</head>
<body>
<table width="418" border="0">
<tr>
<td colspan="3" bgcolor="#333333">新闻种类编辑</td>
</tr>
<tr>
<td width="62">编号</td>
<td width="213" align="center">内容</td>
<td width="129" align="center">编辑</td>
</tr>
<tr>
<td width="62">1</td>
<td width="213" class="content"><div class="show" >军事新闻</div><div class="input" style="display:none;"> <input type="text" value="军事新闻"/></div></td>
<td width="129" id="edit">
<input id="Button1" type="button" value="取消" /> <input id="Button2" type="button" value="修改" disabled="disabled"/>
</td>
</tr>
<tr>
<td width="62">2</td>
<td width="213" class="content"><div class="show" >国际新闻</div><div class="input" style="display:none;"> <input type="text" value="国际新闻"/></div></td>
<td width="129" id="Td1">
<input id="Button3" type="button" value="取消" /> <input id="Button4" type="button" value="修改" disabled="disabled"/>
</td>
</tr>
<tr>
<td width="62">3</td>
<td width="213" class="content"><div class="show" >国内新闻</div><div class="input" style="display:none;"> <input type="text" value="国内新闻"/></div></td>
<td width="129" id="Td2">
<input id="Button5" type="button" value="取消" /> <input id="Button6" type="button" value="修改" disabled="disabled"/>
</td>
</tr>
</table>
</body>
</html>
相关文章推荐
- 使用JQuery 做仿asp.net 中的gridview 控件编辑效果
- 使用jQuery实现ASP.NETGridView折叠伸展效果
- 使用jQuery实现ASP.NETGridView折叠伸展效果 推荐
- ASP.net datalist,gridview 编辑模板里面控件的使用;
- Asp.net的GridView控件实现单元格可编辑方便用户使用
- Asp.net的GridView控件实现单元格可编辑方便用户使用
- 如何用jQuery实现ASP.NET GridView折叠伸展效果
- ASP.NET使用GridView控件、DetailsView控件
- 灵活掌握asp.net中gridview控件的多种使用方法(下)
- 灵活使用asp.net中的gridview控件
- ASP.NET中GridView控件ButtonField的使用
- ASP.NET设计GridView控件的使用方法
- 在asp.net中使用JQuery的SlideViewer插件实现图片的滚动效果
- Jeditable - jQuery就地编辑插件在ASP.NET MVC 中的使用
- [翻译]Scott Mitchell 的ASP.NET 2.0数据教程之十二:在GridView控件中使用TemplateField
- 新写的一个使用ASP.NET AJAX中的UpdatePanel控件实现GridView的无刷新删除,更新,添加,查询!
- 如何用jQuery实现ASP.NET GridView折叠伸展效果
- 在ASP.NET中使用ObjectDataSource数据控件和GridView显示数据(2)
- 灵活掌握asp.net中gridview控件的多种使用方法(上)
- Asp.net 2.0 TreeView控件使用jQuery无刷新添加节点详细说明