TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
hemanth kumar
NA
28
4.2k
How to get the javascript function value in textbox?
Jul 28 2011 2:47 AM
hi,
i am write the javascript function like this, my problem is i can pass the values (quantity and price ) retrive amount, print the amount in lable and textbox(same values), but label is working and textbox value after select another operation first value will come , what is the problem in the code or any modification (i am using OnChange
event) and some time working with IE browser (but add the master page doesnot work any browser)
Divfunction Total(Quantity,Price,Amt)
{
var Quan=document.getElementById(Quantity).value;
var Pric=document.getElementById(Price).value;
var tt=document.getElementById('lblTotal').innerHTML;
//var h=document.getElementById('h1').value;
//tt=h;
if(tt=='')
{
tt=0;
}
if(Quan=='')
{
}
else
{
var cc1=document.getElementById(Amt).value;
if(cc1!='')
{
tt=parseFloat(tt)-parseFloat(cc1);
}
document.getElementById(Amt).value=(parseFloat(Quan)*parseFloat(Pric)).toFixed(2);
var cc=document.getElementById(Amt).value;
//document.getElementById(Amt).value=cc.toFixed(2);
document.getElementById('lblTotal').innerHTML = (parseFloat(tt)+parseFloat(cc)).toFixed(2);
document.getElementById('h1').value=document.getElementById('lblTotal').innerHTML;
document.getElementById("<%= TextBox1.ClientID %>").innerText =document.getElementById('lblTotal').innerHTML;
}
Reply
Answers (
2
)
How to clear browser cookies and cache in code[Code required]
How to make exe of a web based project