|
JohnH -> Problems with Javascript code (2/1/2008 8:16:51)
|
Hi, I found the folling code on the Internet that I use to take VAT (UK tax) from a total amount. By the way, this script is placed in between the HEAD tags. <SCRIPT LANGUAGE="JavaScript"> <!-- Begin function doMath() { var one = eval(document.FrontPage_Form1.total.value) var two = eval(document.FrontPage_Form1.vat.value) var prod = one / two document.FrontPage_Form1.PURCHASE_VALUE.value=custRound(prod,2); } function custRound(x,places) { return (Math.round(x*Math.pow(10,places)))/Math.pow(10,places) } // End --> </SCRIPT> The problem I have is that the javascript only seems to work if FrontPage_Form1 is the first form in the page. That is not the case in my HTML. Can anyone help? Many thanks, John
|
|
|
|