开发者

javascript calendar not working

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜