473,563 Members | 2,797 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="T rue">
</asp:textbox>
<IMG onclick="javasc ript:popUpCalen dar(this,txtlsd ate,'dd-mmm-yyyy');" src="images/calendar/calendar.gif">

<asp:textbox id="txtledate" runat="server" AutoPostBack="T rue">
</asp:textbox>
<IMG onclick="javasc ript:popUpCalen dar(this,txtled ate,'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 "txtTotalLe ave"

For this i've written a javascript function as below:
<script language="javas cript" src="popcalenda r.js" type="text/javascript">
function calc(available, quantity,answer )
{
var var_available = document.getEle mentById(availa ble);
*var var_quantity = document.getEle mentById(quanti ty) ;
*window.alert(" hi.........");
*if ( var_available.v alue == '2' || var_available.v alue == '7' )
*{*
*
* document.getEle mentById(answer ).value=var_ava ilable.value + var_quantity.va lue;
* window.alert('E rror');
***return false;
**}
**return true;
}
</script>
Mar 31 '07 #1
3 4228
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="T rue">
</asp:textbox>
<IMG onclick="javasc ript:popUpCalen dar(this,txtlsd ate,'dd-mmm-yyyy');" src="images/calendar/calendar.gif">

<asp:textbox id="txtledate" runat="server" AutoPostBack="T rue">
</asp:textbox>
<IMG onclick="javasc ript:popUpCalen dar(this,txtled ate,'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 "txtTotalLe ave"

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

<script language="javas cript" src="popcalenda r.js" type="text/javascript">
function calc(txtlsdate, txtledate,txtTo talLeave)
{
var var_1 = document.getEle mentById(txtlsd ate);
var var_2 = document.getEle mentById(txtled ate) ;
document.getEle mentById(txtTot alLeave).value= var_1.value + var_2.value;
}
</script>

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

btnadd.Attribut es.Add("onclick ", "JavaScript : checkall('" + txtlsadate.Clie ntID + "', '" + txtledate.Clien tID + "', '" + txttotalleave.C lientID + "');")

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="T rue">
</asp:textbox>
<IMG onclick="javasc ript:popUpCalen dar(this,txtlsd ate,'dd-mmm-yyyy');" src="images/calendar/calendar.gif">

<asp:textbox id="txtledate" runat="server" AutoPostBack="T rue">
</asp:textbox>
<IMG onclick="javasc ript:popUpCalen dar(this,txtled ate,'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 "txtTotalLe ave"

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

<script language="javas cript" src="popcalenda r.js" type="text/javascript">
function calc(txtlsdate, txtledate,txtTo talLeave)
{
var var_1 = document.getEle mentById(txtlsd ate);
var var_2 = document.getEle mentById(txtled ate) ;
document.getEle mentById(txtTot alLeave).value= var_1.value + var_2.value;
}
</script>

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

btnadd.Attribut es.Add("onclick ", "JavaScript : checkall('" + txtlsadate.Clie ntID + "', '" + txtledate.Clien tID + "', '" + txttotalleave.C lientID + "');")

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
7665
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7583
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7888
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8106
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7642
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6255
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3643
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
924
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.