473,499 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Javascript function in ASP.Net

3 New Member
I'm facing a problem in form related to employee Leave which has two asp controls with calendar image which is built in javascript as,

<asp:textbox id="txtlsdate" runat="server" AutoPostBack="True">
</asp:textbox>
<IMG onclick="javascript:popUpCalendar(this,txtlsdate,' dd-mmm-yyyy');" src="images/calendar/calendar.gif">

<asp:textbox id="txtledate" runat="server" AutoPostBack="True">
</asp:textbox>
<IMG onclick="javascript:popUpCalendar(this,txtledate,' dd-mmm-yyyy');" src="images/calendar/calendar.gif">
Whenever i click on this image and the value of textbox gets changed i want the difference in between the values of date gets calculated and stored in another textbox named "txtTotalLeave"

For this i've written a javascript function as below:
<script language="javascript" src="popcalendar.js" type="text/javascript">
function calc(available,quantity,answer)
{
var var_available = document.getElementById(available);
*var var_quantity = document.getElementById(quantity) ;
*window.alert("hi.........");
*if ( var_available.value == '2' || var_available.value == '7' )
*{*
*
* document.getElementById(answer).value=var_availabl e.value + var_quantity.value;
* window.alert('Error');
***return false;
**}
**return true;
}
</script>
Mar 31 '07 #1
3 4219
chinki
3 New Member
I'm facing a problem in form related to employee Leave which has two asp controls with calendar image which is built in javascript as,

<asp:textbox id="txtlsdate" runat="server" AutoPostBack="True">
</asp:textbox>
<IMG onclick="javascript:popUpCalendar(this,txtlsdate,' dd-mmm-yyyy');" src="images/calendar/calendar.gif">

<asp:textbox id="txtledate" runat="server" AutoPostBack="True">
</asp:textbox>
<IMG onclick="javascript:popUpCalendar(this,txtledate,' dd-mmm-yyyy');" src="images/calendar/calendar.gif">
Whenever i click on this image and the value of textbox gets changed i want the difference in between the values of date gets calculated and stored in another textbox named "txtTotalLeave"

For this i've written a javascript function as below:

<script language="javascript" src="popcalendar.js" type="text/javascript">
function calc(txtlsdate,txtledate,txtTotalLeave)
{
var var_1 = document.getElementById(txtlsdate);
var var_2 = document.getElementById(txtledate) ;
document.getElementById(txtTotalLeave).value=var_1 .value + var_2.value;
}
</script>

I'm calling this function from page_load event of my codebehind file.

btnadd.Attributes.Add("onclick", "javascript: checkall('" + txtlsadate.ClientID + "', '" + txtledate.ClientID + "', '" + txttotalleave.ClientID + "');")

This function is not working and i don't know whats wrong with it?
Mar 31 '07 #2
chinki
3 New Member
I'm facing a problem in form related to employee Leave which has two asp controls with calendar image which is built in javascript as,

<asp:textbox id="txtlsdate" runat="server" AutoPostBack="True">
</asp:textbox>
<IMG onclick="javascript:popUpCalendar(this,txtlsdate,' dd-mmm-yyyy');" src="images/calendar/calendar.gif">

<asp:textbox id="txtledate" runat="server" AutoPostBack="True">
</asp:textbox>
<IMG onclick="javascript:popUpCalendar(this,txtledate,' dd-mmm-yyyy');" src="images/calendar/calendar.gif">
Whenever i click on this image and the value of textbox gets changed i want the difference in between the values of date gets calculated and stored in another textbox named "txtTotalLeave"

For this i've written a javascript function as below:

<script language="javascript" src="popcalendar.js" type="text/javascript">
function calc(txtlsdate,txtledate,txtTotalLeave)
{
var var_1 = document.getElementById(txtlsdate);
var var_2 = document.getElementById(txtledate) ;
document.getElementById(txtTotalLeave).value=var_1 .value + var_2.value;
}
</script>

I'm calling this function from page_load event of my codebehind file.

btnadd.Attributes.Add("onclick", "javascript: checkall('" + txtlsadate.ClientID + "', '" + txtledate.ClientID + "', '" + txttotalleave.ClientID + "');")

This function is not working and i don't know whats wrong with it?
Mar 31 '07 #3
acoder
16,027 Recognized Expert Moderator MVP
Three threads merged. Do not triple post.
Mar 31 '07 #4

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

Similar topics

0
7128
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
7006
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7169
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
7215
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
7385
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
5467
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
3088
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
661
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
294
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.