Login or Sign up Help | Site Map
Connecting Tech Pros Worldwide

change comma to point in real-time?

Question posted by: Piotr (Guest) on July 23rd, 2005 03:56 PM
Is it any way to change comma to point when it is typped into the INPUT
field?
Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
McKirahan's Avatar
McKirahan
Guest
n/a Posts
July 23rd, 2005
03:56 PM
#2

Re: change comma to point in real-time?
"Piotr" <piou@gaztea.pl> wrote in message
news:nrnapqlwo53q.1hdy14vwwziqf.dlg@40tude.net...[color=blue]
> Is it any way to change comma to point when it is typped into the INPUT
> field?[/color]

Will this help? Watch for word-wrap.

<html>
<head>
<title>comadot.htm</title>
<script type="text/javascript">
function commadot(that) {
if (that.value.indexOf(",") >= 0) {
that.value = that.value.replace(/\,/g,".");
}
}
</script>
</head>
<body>
<form>
<input type="text" name="txt" onkeyup="commadot(this)">
</form>
</body>
</html>



Piotr's Avatar
Piotr
Guest
n/a Posts
July 23rd, 2005
03:56 PM
#3

Re: change comma to point in real-time?
it's this, thank you!

Evertjan.'s Avatar
Evertjan.
Guest
n/a Posts
July 23rd, 2005
03:56 PM
#4

Re: change comma to point in real-time?
McKirahan wrote on 12 dec 2004 in comp.lang.javascript:
[color=blue]
> function commadot(that) {
> if (that.value.indexOf(",") >= 0) {
> that.value = that.value.replace(/\,/g,".");
> }
>[/color]

function commadot(that) {
that.value = that.value.replace(/,/g,".");
}


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

McKirahan's Avatar
McKirahan
Guest
n/a Posts
July 23rd, 2005
03:57 PM
#5

Re: change comma to point in real-time?
"Evertjan." <exjxw.hannivoort@interxnl.net> wrote in message
news:Xns95BDC84A26524eejj99@194.109.133.29...[color=blue]
> McKirahan wrote on 12 dec 2004 in comp.lang.javascript:
>[color=green]
> > function commadot(that) {
> > if (that.value.indexOf(",") >= 0) {
> > that.value = that.value.replace(/\,/g,".");
> > }
> >[/color]
>
> function commadot(that) {
> that.value = that.value.replace(/,/g,".");
> }
>
>
> --
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)[/color]

<html>
<head>
<title>comadot.htm</title>
</head>
<body>
<form>
<input type="text" name="txt" onkeyup="this.value =
this.value.replace(/,/g,'.')">
</form>
</body>
</html>



Evertjan.'s Avatar
Evertjan.
Guest
n/a Posts
July 23rd, 2005
03:57 PM
#6

Re: change comma to point in real-time?
McKirahan wrote on 12 dec 2004 in comp.lang.javascript:
[color=blue]
> <input type="text" name="txt" onkeyup="this.value =
> this.value.replace(/,/g,'.')">
>[/color]

<input name="txt" value=""
onkeyup="this.value=this.value.replace(/,/,'.')">

if the value starts at empty,
there never can be more than one comma per keyup,
but for drag-drop and paste, where you were screwed anyway.

one would wish for:

onDragdrop should work only for a window,
and onPaste is nonexistend?

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

 
Not the answer you were looking for? Post your question . . .
180,783 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

  • Didn't find the answer you were looking for?
    Post Your Question
  • Top Community Contributors