Click to See Complete Forum and Search --> : Call tag creating error on page.


kaufman
02-19-2003, 08:02 PM
This is my first project in any language other than HTML, and I know that my method is probably inefficient... but I had to start somewhere...

The script and form I am working with are below. My problem is that <#ShippingCost> is a variable/tag from another application and that application sends the information in the form of "$0.00" as opposed to "0.00" The "$" obviously creates errors on the page. Does anyone have any suggestions? Thanks in advance, and be gentle--My fragile ego is already bruised and battered.

<SCRIPT LANGUAGE="JavaScript">
function ShippingCost_times_AlaskaHawaiiMultiplier(form) {
var ShippingCost=<#ShippingCost>
var AlaskaHawaiiMultiplier=2.25
c=ShippingCost*AlaskaHawaiiMultiplier

form.ans2.value=c
}
</script>

<FORM name="formAlaskaHawaiiShip">
<p align="center"><font face="Arial">
<input type="hidden" name="ShippingCost"> <b>
<input type="button" value=" Calculate " onClick="ShippingCost_times_AlaskaHawaiiMultiplier(this.form)" onMouseOut="parseelement(form.ans2)">
<input type="hidden" name="AlaskaHawaiiMultiplier"> Alaska/Hawaii Shipping:
<input type "number" value=$ name= "ans2" size=9>
</form>

kaufman
02-19-2003, 09:30 PM
The other program is a database and one of the fields is Shipping Cost appropriately tagged #ShippingCost

The database will send this value to an html and javascript environment in the from of <#ShippingCost>

So here is what's happening:

The code I'm using reads:
var ShippingCost=<#ShippingCost>

Assume the value (variable) in the database that is related to #ShippingCost is 0.01. The database sends $0.01, not 0.01 and now I have the problem. I have received no help from the database's technical support group.

Basically, what I am looking for is a way to call <#ShippingCost> then strip the $ from the $0.01 making a new value 0.01


Damn, I hope that made sense!! Sometimes I even confuse myself!

pyro
02-19-2003, 09:41 PM
I think something along these lines is what you are looking for...

<script language="javascript" type="text/javascript">

var test = "$0.01";
holder = test.split("$");
alert (holder[1]);

</script>

kaufman
02-19-2003, 11:09 PM
Thanks--I was able to get it working and I was almost there.
Dropping the $ seemed more difficult than it actually was. Thank you Mr. Clark as you saved me lots of time.

Hopefully, as I get more experienced at this, I can return the favor to others!

"ope day goze graphitee"