日期:2014-05-20 浏览次数:20662 次
前台代码 <script type="text/javascript"> function chkStatus(status,qishu) { var getuser="<%=getNameAndOrGuess("+qishu+") %>";//这个方法怎么获取qishu???? var u_s=new Array(); u_s=getuser.split('|'); var userName=u_s[0]; var state=u_s[1]; switch (status) { case '0' : { //在这里面判断 username和state document.write("<a class='syl_jc_zj' href='Insert.aspx?LID=="+qishu+"' target='_blank'>开始</a>") break; } case '1': { document.write("<a href='Detail.aspx?LID="+qishu+"' target='_blank'>终止</a>") break; } case '2': { document.write("<a href='Detail.aspx?LID="+qishu+"' target='_blank'>结束</a>") break; } } } </script> ....... <asp:Repeater ID="rptddd" runat="server" > <HeaderTemplate> <table width="936" border="0" cellpadding="0" cellspacing="1" bgcolor="#FFB91F" align="center" style="color:Black;" id="panel" > <tr align="center"> <td class="content_heard_style">期号</td> <td class="content_heard_style">参与</td> </tr> </table> </HeaderTemplate> <ItemTemplate> <table width="936" border="0" cellpadding="0" cellspacing="1" bgcolor="#FFB91F" align="center" style="color:Black;" id="tbID" > <tr align="center" bgcolor="#FFFFFF" id="t_lucky" runat="server"> <td height="32" bgcolor="#FFFaC7" > <asp:Label ID="lblqihao" runat="server" Text='<%#Eval("ID") %>'></asp:Label></td> <td bgcolor="#FFFFFF" > <script language="javascript" type="text/javascript">chkStatus('<%#Eval("State") %>','<%#Eval("ID") %>');</script> </td> </tr> </table> </ItemTemplate> </asp:Repeater> 后台 public string getNameAndOrGuess(string qihao) { if (Session["User_Session"] != null) { //根据期号获取当前时间,从数据库中读取 DateTime xtTime = Convert.ToDateTime("2012-06-26 17:50:00"); DateTime dqTime = DateTime.Now; if (dqTime < xtTime) { return userName + "|" + "1"; } return "" + "|" + ""; } else { return "" + "|" + ""; } } 问题:var getuser="<%=getNameAndOrGuess("+qishu+") %>";//获取不到qishu,,,请问客户端应该怎么获取???