CNNTEC新浪官方微博  CNNTEC腾迅官方微博

中国微软.NET技术交流社区-CNNTEC官方网站,ASP.NET源码,ASP.NET视频教程,asp.net教程,asp.net,c#

注册

 

发新话题 回复该主题

[原创贴] asp实现类似dotnet中GridView中的编辑的效果 (代码已发) [复制链接]

楼主
实现效果,类似dotnet中GridView中的编辑的效果! 简化后全部的 asp 代码: <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%> <!--#include file="../public/conn.asp"--> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" c /> <title>无标题文档</title> <script language="javascript"> function showtr() { alert(document.activeElement.value); if (document.getElementById("showmanage").style.display=="block") {   document.getElementById("showmanage").style.display="none"; } else {   document.getElementById("showmanage").style.display="block"; } if (document.getElementById("nonetable").style.display=="block") {   document.getElementById("nonetable").style.display="none"; } else {   document.getElementById("nonetable").style.display="block"; } } </script> <% sql="select * from [user]" rs.open sql,conn,1,3 %> </head> <body> <table border="0">   <tr>     <td><table border="0">       <tr>         <td class="STYLE6">用户名</td>         <td class="STYLE6">管理员操作</td>       </tr> <% while not rs.eof %>     <tr id="showmanage" style="display:block;">         <td class="STYLE6"><%=rs("user_name")%></td>   <td class="STYLE6">   <input type="button" name="Submit22" value="编辑" />   <input type="submit" name="Submit2" value="删除" />   </td> </tr> <tr id="nonetable" style="display:none;">   <td class="STYLE6"><input name="username2" type="text" value="<%=rs("user_name")%>" size="10"/></td>   <td class="STYLE6">   <input type="submit" name="Syes" value="确认" />   <input type="button" name="cancel" value="取消" />   </td> </tr> <% rs.MoveNext wend %>     </table> </td>   </tr> </table> </body> </html> 这个实现的效果是第一行可以编辑,点击其他行都只能对第一行进行编辑,我知道原因了是我获取的name的问题,但是,不知道如何解决! 希望各位大哥大姐们帮帮忙!
分享 转发
TOP
沙发

showtr() 哪里调用了?

showtr() 哪里调用了?
烟台日金钢格板 钢格板 steel grating
TOP
板凳

回复 2# hujiaben 的帖子

不好意思,可能删了,我补一下!
TOP
地板

回复 1# 【上海】疯子 的帖子

<input type="button" name="Submit22" value="编辑" onClick="showtr();"/> <input type="submit" name="Syes" value="确认" onClick="javascript: window.location.reload('adusermanage.asp?kind=确认')"/> <input type="button" name="cancel" value="取消" onClick="showtr();"/>
TOP
围观群众

效果完成

<!--#include file="../Assembly.Include.asp"--> <!--#include file="../Assembly.Response.asp"--> <script language="javascript" src="../js/changcolor.js"></script> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" c /> <title>无标题文档</title> <script language="javascript"> function showtr(idx,maxidx) {         for(i=1;i<=maxidx;i++){                 var listRow = document.getElementById("showmanage_"+i);                 var editRow = document.getElementById("nonetable_"+i);                 if(i==idx){                         if (listRow.style.display=="block")                         {                                 listRow.style.display="none";                         }                         else                         {                                 listRow.style.display="block";                         }                                                  if (editRow.style.display=="block")                         {                                 editRow.style.display="none";                         }                         else                         {                                 editRow.style.display="block";                         }                                          }else{                         editRow.style.display="none";;                         listRow.style.display="block"                 }         } } </script> <style type="text/css"> <!-- .STYLE1 {font-weight: bold} .STYLE2 {font-size: 14px} .STYLE3 {font-size: 14px} .STYLE4 {font-size: 12px; } .STYLE5 {color: #000000} .STYLE6 {font-size: 14px; color: #000000; } .STYLE8 {         font-size: 14px;         color: #000000;         font-weight: bold; } --> </style> <% sql="select * from [user]" rs.open sql,conn,1,1 %> </head> <body> <table border="0">   <tr>     <td><!--#include file="../public/top2.asp"--></td>   </tr>   <tr> <td> <table border="0">   <tr>     <td><span class="STYLE8">添新用户:</span></td>   </tr>   <tr> <td><form action="adusermanage.asp" method="post"><span class="STYLE6">用户类别:     <select name="userkind">       <option>医生</option>       <option>前台</option>     </select> 用户名: <input name="username" type="text" size="10" /> 用户密码: <input name="userpwd" type="text" size="10" /> 重复密码: <input name="userpwd2" type="text" size="10" /> <input type="submit" name="Submit" value="添加用户" /> </span></form></td>   </tr>   <tr>     <td><table border="0">   <tr>     <td class="STYLE6">用户名</td>     <td class="STYLE6">用户类别</td>     <td class="STYLE6">创建时间</td>     <td class="STYLE6">登陆次数</td>     <td class="STYLE6">用户状态</td>     <td class="STYLE6">管理员操作</td>   </tr>   <%           dim rowIndex:rowIndex=1         while not rs.eof %> <form action="adusermanage.asp" method="post">   <tr id="showmanage_<%=rowIndex %>" style="display:block;">     <td class="STYLE6"><%=rs("user_name")%>       <input type="hidden" name="uid" value="<%=rs("id")%>" />     </td>     <td class="STYLE6"><%=rs("user_kind")%></td>     <td class="STYLE6"><%=rs("Idate")%></td>     <td class="STYLE6"><%=rs("loginnum")%></td>     <% if rs("disabled")=0 then %>     <td class="STYLE6">未审核</td>     <% elseif rs("disabled")=1 then %>     <td class="STYLE6">以审核</td>     <% end if %>     <td class="STYLE6"><input type="button" name="Submit22" value="编辑" />       <input type="submit" name="Submit2" value="删除" />       <%         if rs("disabled")=0 then %>       <input type="submit" name="Submit23" value="确认审核" />       <%         elseif rs("disabled")=1 then %>       <input type="submit" name="Submita" value="确认审核" disabled="disabled"/>       <%         end if %></td>   </tr>   <tr id="nonetable_<%=rowIndex %>" style="display:none;">     <td class="STYLE6"><input name="username2" type="text" value="<%=rs("user_name")%>" size="10"/></td>     <td class="STYLE6"><input name="userkind2" type="text" value="<%=rs("user_kind")%>" size="10" /></td>     <td class="STYLE6"><%=rs("Idate")%></td>     <td class="STYLE6"><%=rs("loginnum")%></td>     <% if rs("disabled")=0 then %>     <td class="STYLE6">未审核</td>     <% elseif rs("disabled")=1 then %>     <td class="STYLE6">以审核</td>     <% end if %>     <td class="STYLE6"><input type="submit" name="Syes" value="确认" />       <input type="button" name="cancel" value="取消" />     </td>   </tr>   </form>   <%           rowIndex=rowIndex+1         rs.MoveNext         wend %> </table> </td>   </tr> </table> </form> </td>   </tr>   <tr>     <td><!--#include file="../public/foot.asp"--></td>   </tr> </table> </body> </html>
TOP
打酱油的

回复 5# 【上海】疯子 的帖子

这是一个类似于dotnet中gridview 的编辑效果,用asp来实现的!可能还有不少bug但是功能的确实现了!需要的可以看下!
TOP
飘过的

支持劳动成果,感谢分享代码。
TOP
路过的

还没有学习到这里先学习学习

还没有学习到这里先学习学习
TOP
发新话题 回复该主题