Connecting Tech Pros Worldwide Help | Site Map

change comma to point in real-time?

Piotr
Guest
 
Posts: n/a
#1: Jul 23 '05
Is it any way to change comma to point when it is typped into the INPUT
field?
McKirahan
Guest
 
Posts: n/a
#2: Jul 23 '05

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
Guest
 
Posts: n/a
#3: Jul 23 '05

re: change comma to point in real-time?


it's this, thank you!
Evertjan.
Guest
 
Posts: n/a
#4: Jul 23 '05

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
Guest
 
Posts: n/a
#5: Jul 23 '05

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.
Guest
 
Posts: n/a
#6: Jul 23 '05

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)
Closed Thread