470,647 Members | 1,085 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,647 developers. It's quick & easy.

dropdown calendar control with HTML <INPUT> control

Hai all,

I am trying to create dropdown calendar control with HTML input control by writing JavaScript. But while executing I am getting the error as "Error on Page" on the status bar of the browser. I wrote the following code in the HTML code for the web form:

<%@ Page language="c#" Codebehind="WebForm2.aspx.cs" AutoEventWireup="false" Inherits="calendar.WebForm2" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<script type="text/javascript">
function onClick()
if (divCalendar.style .display ="none")
divCalendar.style .display ="";
divCalendar.style .display ="none";

<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<body MS_POSITIONING="GridLayout" onload ="hello()">
<form id="Form1" method="post" runat="server">
<DIV id="divCalendar" style="Z-INDEX: 104; LEFT: 392px; WIDTH: 256px; POSITION: absolute; TOP: 144px; HEIGHT: 216px"
ms_positioning="FlowLayout"><asp:textbox id="TextBox1" runat="server"></asp:textbox><INPUT id="onClick" onclick ="onClick()" type="button" value="Call function">
<asp:calendar id="Calendar1" runat="server" Visible="False"></asp:calendar></DIV>
<asp:button id="Button1" style="Z-INDEX: 102; LEFT: 184px; POSITION: absolute; TOP: 8px" runat="server"
This browser does not support script</noscript>

If I use webserver button control instead of HTML input control and I write the following code

private void Button1_Click(object sender, System.EventArgs e)
if(Calendar1.Visible ==true)
Calendar1.Visible =false;
Calendar1.Visible =true;

in the button click event, then it is working fine.
My requirement is the calendar control is to be displayed when I click the HTML Input control. If I click once again it should disappear.
Please help me where I am doing mistake while writing JavaScript.
May 10 '07 #1
2 10544
14,534 Expert Mod 8TB
This question is being moved to the HTML forum.

May 10 '07 #2
7,435 Expert 4TB
Moved to asp.
May 11 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Bhavin | last post: by
4 posts views Thread by Martin Lucas-Smith | last post: by
2 posts views Thread by not 2 swift | last post: by
3 posts views Thread by iinet | last post: by
1 post views Thread by Knut-Frode Dagestad | last post: by
2 posts views Thread by Richard Maher | last post: by
1 post views Thread by Korara | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.