前台:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="11111.aspx.cs" Inherits="YTOA.WEB.OA._1111" %>
<!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 runat="server"> <title></title>
<script type="text/javascript"> function showtable(x) { alert(x); var Tdvalue = document.getElementById(x); Tdvalue.innerHTML = x + x; //alert(Tdvalue.innerHTML); var evt = window.event; xPos = evt.clientX + 3; yPos = evt.clientY + 2; var qq = document.getElementById("qq"); qq.style.top = parseInt(yPos) + 2 + "px"; qq.style.left = parseInt(xPos) + 2 + "px"; qq.style.visibility = "visible"; }
function closetable() { qq.style.visibility = "hidden"; } </script>
</head> <body> <form id="form1" runat="server"> <div> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <%=FamilyStr%> </td> </tr> </table> </div> <div id="qq" style="position: absolute; top: 0; left: 0; visibility:hidden; width: 370; background-color: #FFFFCC"> <table> <tr> <td> 111111111 </td> <td width="50" onclick="closetable()"> 关闭 </td> </tr> </table> </div> </form> </body> </html>
后台:
using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Text;
namespace YTOA.WEB.OA { public partial class _1111 : System.Web.UI.Page { protected string FamilyStr = ""; protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BuiltAirTable(); } } /// <summary> /// 生成表 /// </summary> /// <param name="cno"></param> private void BuiltAirTable() { StringBuilder sb = new StringBuilder(); sb.Append("<table width='100%' border='0' cellpadding='0' cellspacing='1' class='tablebgcolor1'>"); sb.Append("<tr>"); sb.Append("<td align='center' class='textalignleft' width='14%' colspan='7' height='26px'>"); sb.Append("申请人家庭情况"); sb.Append("</td>"); sb.Append("</tr>"); sb.Append("<tr>"); sb.Append("<td align='center' width='14%' height='26px'>"); sb.Append("子女姓名"); sb.Append("</td>"); sb.Append("<td align='center' width='14%'>"); sb.Append("是否与老人同住"); sb.Append("</td>"); sb.Append("<td align='center' width='14%'>"); sb.Append("是否在哈市居住"); sb.Append("</td>"); sb.Append("<td align='center' >"); sb.Append("是否享受低保"); sb.Append("</td>"); sb.Append("<td align='center' >"); sb.Append("是否重度残疾"); sb.Append("</td>"); sb.Append("<td align='center' >"); sb.Append("住宅电话"); sb.Append("</td>"); sb.Append("<td align='center' >"); sb.Append("移动电话"); sb.Append("</td>"); sb.Append("</tr>"); for (int i = 0; i < 5; i++) { sb.Append("<tr>"); sb.Append("<td style='text-align:center;' width='14%' height='26px' id='a" + i + "' onclick=\"showtable('a" + i + "')\">"); sb.Append(i); sb.Append("</td>"); sb.Append("<td style='text-align:center;' width='14%' id='b" + i + "' onclick=\"showtable('b" + i + "')\">"); sb.Append(i); sb.Append("</td>"); sb.Append("<td style='text-align:center;' width='14%' id='c" + i + "' onclick=\"showtable('c" + i + "')\">"); sb.Append(i); sb.Append("</td>"); sb.Append("<td style='text-align:center;' width='14%' id='d" + i + "' onclick=\"showtable('d" + i + "')\">"); sb.Append(i); sb.Append("</td>"); sb.Append("<td style='text-align:center;' width='14%' id='e" + i + "' onclick=\"showtable('e" + i + "')\">"); sb.Append(i); sb.Append("</td>"); sb.Append("<td style='text-align:center;' width='14%' id='f" + i + "' onclick=\"showtable('f" + i + "')\">"); sb.Append(i); sb.Append("</td>"); sb.Append("<td style='text-align:center;' id='g" + i + "' onclick=\"showtable('g" + i + "')\">"); sb.Append(i); sb.Append("</td>"); sb.Append("</tr>"); } FamilyStr = sb.ToString(); } } }
|