Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Professional
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 1st, 2010, 10:12 AM
Authorized User
Points: 373, Level: 6
Points: 373, Level: 6 Points: 373, Level: 6 Points: 373, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2004
Location: , , .
Posts: 68
Thanks: 1
Thanked 0 Times in 0 Posts
Default Write variable from JavaScript to ASP page

Good morning.

I'm building an expense report in ASP. People will enter their expenses on a form (they can enter up to 20 expenses) and at the bottom of the form a running total (in US dollars) will appear. When the user exits the field (onblur), javascript is called which adds up the numbers and stores the total in a variable.

I need to display this JavaScript variable on my form but I can't figure out how to do this: I can't figure out how to display the JavaScript variable inside my asp code.

I WAS able to use an input text field and use that for the running USD total. I would simply set the value of the input text field to the javaScript totals field and all was well however, I don't like the way the input field looks: users may think they can type inside it.

Please help: I just want to display the total as text only!

Thank you!

Sal
Reply With Quote
  #2 (permalink)  
Old November 1st, 2010, 03:25 PM
Friend of Wrox
 
Join Date: Jun 2008
Location: Snohomish, WA, USA
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

Code:
Total is $<span id="total" style="...your choices...">0.00</span>

and then 

document.getElementById("total").innerHTML = total.toFixed(2);
Another choice: Go ahead and use an <input> field. But do this to it:
Code:
<input name="total" readonly style="border: none; background-color: #eeeeee;" />
That is, style the input so it no longer looks like an input field. And make it readonly, so the user *can't* type in it.

If this doesn't help, show your JS code.
Reply With Quote
  #3 (permalink)  
Old November 2nd, 2010, 01:40 PM
Authorized User
Points: 373, Level: 6
Points: 373, Level: 6 Points: 373, Level: 6 Points: 373, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2004
Location: , , .
Posts: 68
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Thank you!

getElementById is working well.

sal
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
storing Javascript variable to ASP variable rupen Classic ASP Basics 5 April 10th, 2007 07:06 AM
assign javascript variable to asp variable manjunath_c_k Classic ASP Basics 1 September 14th, 2006 07:35 AM
ASP variable inside my JavaScript crmpicco Javascript How-To 1 June 4th, 2005 12:17 AM
set a asp variable with a value in Javascript crmpicco Javascript How-To 6 March 11th, 2005 11:07 AM
using asp to write javascript vivalet Classic ASP Basics 3 November 6th, 2003 02:02 PM



All times are GMT -4. The time now is 10:02 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.