开发者

javascript calendar not working

开发者 https://www.devze.com 2023-03-28 04:54 出处:网络
I have JavaScript Calendar in my web page. The following code is not working: <td> <asp:TextBox ID=\"txt_datefrm\" runat=\"server\" Width=\"71px\"></asp:TextBox>

I have JavaScript Calendar in my web page.

The following code is not working:

<td> 
    <asp:TextBox ID="txt_datefrm" runat="server" Width="71px"></asp:TextBox> 
  <a href="javascript:OpenCalFuture('ctl00_ContentPlaceHolder1_txt_datefrm');">
                      <img src="cal.gif"  border="0" height="16" width="16"/></a>

开发者_运维知识库</td>

Any idea on what could have gone wrong here?

Thank you.


Try using the UniqueID instead of hardcoding the ID:

OpenCalFuture('<%=txt_datefrm.UniqueID%>');


If you're looking for a small pop-up calendar, to make it easier for the user to pop a date string into a text field, you should really give jQuery datepicker a try. It's an excellent tool (all of jquery is, really)


Try this instead:

<asp:Calendar id="MyCalendar" runat="server"></asp:Calendar>

It looks to me like you're trying to instantiate a C# class in a javascript code block.

0

精彩评论

暂无评论...
验证码 换一张
取 消