我在用户控件中加了JS,但是,当点击时会弹出对话框,出现乱码

解决方案 »

  1.   

    <%@ Control Language="c#" AutoEventWireup="false" Codebehind="SerchTime.ascx.cs" Inherits="CS_System.SerchTime" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
    <LINK href="CSSystem.css" type="text/css" rel="stylesheet">
    <script language="JavaScript" src="js/calendar.js" type="text/javascript"></script><FONT face="宋体">
    <TABLE class="NavigationColor" id="Table1" style="WIDTH: 416px; HEIGHT: 28px" cellSpacing="1"
    cellPadding="1" width="416" border="0">
    <TR>
    <TD style="WIDTH: 63px">起始时间</TD>
    <TD style="WIDTH: 138px">
    <asp:textbox id="txtDate1" onclick="javascript:event.cancelBubble=true;showCalendar('newcalendar1',false,'txtDate1','','','2004-12-01','2006-12-30','','','')"
    runat="server" Width="100px"></asp:textbox>
    <A onmouseover="window.status='Calendar';return true;" onmouseout="window.status='';"
    href="javascript:showCalendar('newcalendar1',false,'txtDate1','','','2004-12-01','2006-12-30','','','')"
    target="_self"><IMG id="newcalendar1" height="21" alt="" src="images/calendar_p.gif" width="25" align="absMiddle"
    border="0"></A></TD>
    <TD style="WIDTH: 62px">截止时间</TD>
    <TD>
    <asp:TextBox id="txtDate2" runat="server" onclick="javascript:event.cancelBubble=true;showCalendar('newcalendar2',false,'txtDate2','','','2004-12-01','2006-12-30','','','')"
    Width="100px"></asp:TextBox>
    <A onmouseover="window.status='Calendar';return true;" onmouseout="window.status='';"
    href="javascript:showCalendar('newcalendar2',false,'txtDate2','','','2004-12-01','2006-12-30','','','')"
    target="_self"><IMG id="newcalendar2" height="21" alt="" src="images/calendar_p.gif" width="25" align="absMiddle"
    border="0"></A></TD>
    </TR>
    </TABLE>
    </FONT>
      

  2.   

    this.txtDate1.Attributes.Add("onclick","javascript:event.cancelBubble=true;showCalendar('newcalendar1',false,'txtDate1','','','2004-12-01','2006-12-30','','','')")