codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Object doesn`t support property or method  yomac at 13:38 on Thursday, November 13, 2003
 

Hi , I am trying to do a simple calculation of two input boxes and output the answer to a third box whilst rounding the numbers to 2 decimal places. Below is my code but I keep getting an error object doesn't support this property or method for line document.stock.getElementById('mus_tot').value = yourTotal;

CODE:
<script type="text/JavaScript">
function round(number,X)
{
X = (!X ? 2 : X);
return Math.round(number*Math.pow(10,X))/Math.pow(10,X);
}

function purchase_mus(day1,day2)
{
var yourTotal = round((parseFloat(day1)+parseFloat(day2)),2);

document.stock.getElementById('mus_tot').value = yourTotal;


}


</script>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<form name="stock" method="post" action="/forum/add_to_stock_take.html">
<td width="18%" height="30"><input name="mus_mon" ></td>
<td width="18%" height="30"><input name="mus_tue" >
=</td>

<td width="18%" height="30"><input name="mus_tot" ></td>
<input type="button" width="50" height="20" value="Calculate" onClick="purchase_mus(mus_mon.value,mus_tue.value)"; name="button2">
</form>










CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  XML- Passing parameters are Latitude and Longitude.
•  Re: Format Date time issue....
•  Re: How to freeze the web page when displaying progress bar?
•  Re: Help! IFrames!
•  Re: Help: Trouble with z-Index and SELECT lists
•  Re: HOW CREATE LINE CHARTS IN ASP.NET
•  How to store and retrieve document into database
•  Re: text field multiple
•  Re: after updation of a table open another program .. need help


Recent Articles
Communicating with the Database (Using ADO)
MagicGrid
Simple Thumbnail Browsing Solution
Type Anywhere
A Better Moustrap: FmtDate to replace FormatDateTime
ASP.NET Forum Source Code
Internal Search Engine
Javascript Growing Window
Simple date validation
Search engine friendly URLs using ASP.NET (C#.NET)


Site Survey
Help us serve you better. Take a five minute survey. Click here!

© Copyright codetoad.com 2001-2005