Top.Mail.Ru
? ?
Javascript's Journal
 
[Most Recent Entries] [Calendar View] [Friends View]

Monday, November 7th, 2005

Time Event
1:44p
Why this this failing???
This is for a currency field (num). The value should always be in the form of "$" + a two-decimal floating number. (eg: $24.00, not $24)

var amt = parseFloat(num.substring(1,num.length))
if (isNaN(amt) || amt.toString() != num.substring(1,num.length))
     if (isNaN(amt)) alert('Not a Number!');
     if (amt.toString() != num.substring(1,num.length))
         alert ('Value Entered: ' + num.substring(1, num.length));
         alert ('Number Value: ' + amt);
         alert ('String Value: ' + amt.toString());
     return false;


When I run the script, I keep hitting the if (amt.toString() != num.substring(1,num.length)) condition, even when the Value Entered, the Number Value, and the String Value are all the same.
3:20p
javascript html random question:
so what i'm trying to do is this:

i have a page with javascript enabled. when the checkboxes are checked, different cells pop up, for instance this one:
Image

this button, however, does nothing. what i want it to do, is take the text and display it down in a new cell (where the "this is ridiculous" text is now):
Image

i am having trouble figuring out how to pass the text into the html.
it's blowing my mind.

if you could help me out, it would be greatly appreciated. :)

thanks.


EDIT:: NEW PROBLEM::

so.. now i've created these text boxes in a loop so that every time the loop executes another textbox appears... in the vein of
input type='text' name='order"+i+"' size='3'

later.. i have a function that wants to get the values from these text boxes, but i can't seem to figure out how to do this..

i've been trying along the lines of putting this:
var name = "form.order"+i+".value";
orderArray[i] = name;

in a loop... but for obvious reasons that doesn't work..

suggestions??

<< Previous Day 2005/11/07
[Calendar]
Next Day >>
About LiveJournal.com
Image