Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To 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 June 2nd, 2004, 03:28 PM
Registered User
 
Join Date: Jun 2004
Location: Bentonville, AR, USA.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default using variables within <td> tags

I am fairly new to web page designing although I have been a programmer for over 20 years. I am attempting to create a page with an "excel" looking table format. The user can input numeric data into two of the six cells. What I am trying to do is do background calculations based on those entries and output the results to the other four cells. I am in way over my head with this one.

handyman
Reply With Quote
  #2 (permalink)  
Old June 2nd, 2004, 03:46 PM
Friend of Wrox
 
Join Date: Nov 2003
Location: , , .
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Uhh... have you accomplished any of this task, or are you starting from scratch?

Snib

<><
Reply With Quote
  #3 (permalink)  
Old June 3rd, 2004, 08:06 AM
Registered User
 
Join Date: Jun 2004
Location: Bentonville, AR, USA.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I apologize for the delay. We had a thunderstorm "crop up" on us and ligthning strikes play havoc with my modem.

Here is what I have coded:

<html>

<head>
<title></title>
</head>

<body bgcolor="#CC9966">

<script>
  var K = 0, D = 0.0, K25 = 0, K30 = 0, D25 = 0.0, D30 = 0.0;
</script>
<table border="1" width="98%" bordercolor="#808080" bordercolorlight="#808080"
bordercolordark="#808080">
  <tr>
    <th width="15%" valign="middle" align="center" bgcolor="#FFFF00"></th>
    <th width="15%" valign="middle" align="center" bgcolor="#FFFF00"></th>
    <th width="25%" valign="middle" align="center" bgcolor="#FFFF00" colspan="2">25%
     Savings</th>
    <th width="25%" valign="middle" align="center" bgcolor="#FFFF00" colspan="2">30%
      Savings</th>
  </tr>
  <tr>
    <th width="15%" valign="middle" align="center" bgcolor="#FFFF00">H</th>
    <th width="15%" valign="middle" align="center" bgcolor="#FFFF00">A</th>
    <th width="13%" valign="middle" align="center" bgcolor="#FFFF00">K</th>
    <th width="12%" valign="middle" align="center" bgcolor="#FFFF00">D</th>
    <th width="13%" valign="middle" align="center" bgcolor="#FFFF00">K</th>
    <th width="12%" valign="middle" align="center" bgcolor="#FFFF00">D</th>
  </tr>
  <tr>
    <td width="15%" bgcolor="#FFFFFF" valign="middle" align="justify">&nbsp; <input
      size="14" name="K" value tabindex="1" onrowexit="calcK(K)"></td>
    <td width="15%" valign="middle" align="justify" bgcolor="#FFFFFF">&nbsp; <!--webbot
      bot="Validation" s-data-type="Number" s-number-separators=",." --><input
      size="14" name="D" value tabindex="2" onrowexit="calcD(D)"></td>
    <td width="13%" valign="middle" align="center" bgcolor="#C0C0C0">&nbsp; <input
      type="hidden" value name="K25"></td>
    <td width="12%" valign="middle" align="center" bgcolor="#C0C0C0">&nbsp; <input
      type="hidden" value name="D25"></td>
    <td width="13%" valign="middle" align="center" bgcolor="#C0C0C0">&nbsp; <input
      type="hidden" value name="K30"></td>
    <td width="12%" valign="middle" align="center" bgcolor="#C0C0C0">&nbsp; <input
      type="hidden" value name="D30"></td>
  </tr>
</table>
<script>
   function calcK(K)
   {
   K25 = K - (K * .25);
   K30 = K - (K * .30);
    }
   function calcD(D)
   {
   D25 = D - (D * .25);
   D30 = D - (D * .30);
    }
</script>

</body>

</html>

It is at this point that I get completely lost.

handyman
Reply With Quote
  #4 (permalink)  
Old June 15th, 2004, 11:18 PM
Registered User
 
Join Date: Jun 2004
Location: Bentonville, AR, USA.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey,

I figured it out. I guess you can't use type="hidden" and expect it to show you a value. I, also, used readonly=true to prevent modifications within the cells.

Thanks anyway,

handyman
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
Change data of <TD> austinf Javascript 3 July 28th, 2006 05:32 AM
Fixing <TD> size. rupen HTML Code Clinic 4 April 28th, 2006 07:41 AM
change <td> value onClick crmpicco Javascript How-To 2 August 23rd, 2005 07:31 AM
<style> tags in a <body> vs. <div> bcat BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 1 March 27th, 2005 08:50 AM
XML into <td> crmpicco Classic ASP Basics 4 February 11th, 2005 09:57 AM



All times are GMT -4. The time now is 03:12 AM.


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