473,406 Members | 2,293 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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" >
<HTML>
<HEAD>
<script type="text/javascript">
<!--
function onClick()
{
if (divCalendar.style .display ="none")
divCalendar.style .display ="";
else
divCalendar.style .display ="none";
}
//-->
</script>

<title>WebForm2</title>
<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">
</HEAD>
<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"
Text="Button"></asp:button></form>
<noscript>
This browser does not support script</noscript>
</body>
</HTML>

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;
else
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 10705
MMcCarthy
14,534 Expert Mod 8TB
This question is being moved to the HTML forum.

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

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

Similar topics

2
by: Bhavin | last post by:
Hi I'm trying to set default value for input type file. <input type="File" name="tx_pdffile" accept="*.pdf" class="boxText" value="abc.pdf"> but this value (abc.pdf) doesnt appear in the text...
4
by: Martin Lucas-Smith | last post by:
I am wanting to know whether are XHTML1-valid characters for use within an id attribute and/or a name attribute. ...
2
by: not 2 swift | last post by:
I thought I would update an old page on which I had used a <INPUT TYPE=image ...> with a <BUTTON><IMG SRC=...></BUTTON> The problem is that <BUTTON> always provides a shadow/emboss effect. Can...
3
by: iinet | last post by:
How can i set in my css a min width for input elements, but leave the max size dynamic? Ben
3
by: TR | last post by:
Is it possible with CSS to prevent this wrapping alignment with a checkbox with a nested label? This is the label of the checkbox that wraps beneath it I'd prefer it looked like...
3
by: Ben | last post by:
Here's my form: <form name="aForm" method='post'> <input type=file name=file1 onkeypress='KeyPress()'><br> <a id='attachMoreLink' href='javascript:AddFileInput()">Attach More Files </a> <input...
1
by: Knut-Frode Dagestad | last post by:
I have a <selectlist in some html code with hundreds of options. Is it possible to use javascript to jump to the next/previous item in the list? Knut-Frode
2
by: Richard Maher | last post by:
Hi, I'm trying to use the Visibility Style attribute for a Div to effectively PopUp a lightweight window with some additional context-sensitive information, when a user mouses over a given...
3
by: Gert | last post by:
Would it be possible to access the file CONTENT in codebehind for a standard: <input id="htmlFile" type="file" /> Then in codebehind: foreach (string keyName in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.