Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding totals and restricting format...

Status
Not open for further replies.

WhiteTiger

Programmer
Jun 26, 2001
605
US
How can I restrict text boxes to be numbers only format?

And how, when the focus is acheived or lost, can I get 1 'total' textbox to calculate values?

I'm looking to do an excel type thing, but its mainly for entering dollar amounts for employee reimbursement if they use their car, or perhaps, for us to bill a company Regards,
Anth:cool:ny
----------------------------------------
"You say [red]insanity[/red] like it's a BAD THING!"
 
hie Luke
1: if(typeof(variable)!=number){alert("aaa.. i cant do that.. khhheh-heh-heh")}
or if (isNaN(variable)) {alert('& i cant do THAT either..')}
now i'm workin with the second part, hang on.. regards, vic
 
lol, I like that...I shall put 'mwa ha hahahahahah!' as my phrase...

And where would I put this?...any keypress functions or anything? Regards,
Anth:cool:ny
----------------------------------------
"You say [red]insanity[/red] like it's a BAD THING!"
 
hie
function validate(obj){
if(isNaN(obj.value)) alert("a-aa!")
}

~~~~~~~~~~~

<input type=text name=txt1 onchange=&quot;validate(this)&quot;>

or smth like that - sorry, didnt tryed myself.. regards, vic
 
Thanx Vituz, your always a help...NOW I know what forum you hang out in all day! ;-) Regards,
Anth:cool:ny
----------------------------------------
&quot;You say [red]insanity[/red] like it's a BAD THING!&quot;
 
Ok, I got it to check, but how would I change the text to go blank if it 'errors'?

Also, is there a way to check on keypress? Regards,
Anth:cool:ny
----------------------------------------
&quot;You say [red]insanity[/red] like it's a BAD THING!&quot;
 
got it...nevermind...sheesh...lol Regards,
Anth:cool:ny
----------------------------------------
&quot;You say [red]insanity[/red] like it's a BAD THING!&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top