I've been trying to figure this out for a long long time, and would appreciate any help.
The code is as follows, which can be seen here http://incoming.comule.com/isnan.html
<script>
var price = new Array();
function add(price) {
//alert("function add: is price not a number? = "+isNaN(price));
price[0] = price;
}
function addman() {
price[0] = 0.87;
}
function status() {
alert(price[0]);
}
function num() {
alert("function Number: is price not a number? = "+isNaN(Number(price[0])));
}
function pInt() {
alert("function parseInt: is price not a number? = "+isNaN(parseInt(price[0])));
}
function pFloat() {
alert("function parseFloat: is price not a number? = "+isNaN(parseFloat(price[0])));
}
</script>
<a href="javascript:add('0.45');">Add price 0.45</a> then click ... <a href="javascript:status();">status</a> ,
<a href="javascript:num();">number</a> , <a href="javascript:pInt();">parseInt</a> , <a href="javascript:pFloat();">parseFloat</a>
<p>
<a href="javascript:addman();">set manually</a>
When I click add price, then status, it shows as undefined, but when I click set manually then status, the status shows the value. The only difference is how it is being set, does anyone know how I can add this via a function variable ?