Connecting Tech Pros Worldwide Help | Site Map

change comma to point in real-time?

  #1  
Old July 23rd, 2005, 04:56 PM
Piotr
Guest
 
Posts: n/a
Is it any way to change comma to point when it is typped into the INPUT
field?
  #2  
Old July 23rd, 2005, 04:56 PM
McKirahan
Guest
 
Posts: n/a

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>


  #3  
Old July 23rd, 2005, 04:56 PM
Piotr
Guest
 
Posts: n/a

re: change comma to point in real-time?


it's this, thank you!
  #4  
Old July 23rd, 2005, 04:56 PM
Evertjan.
Guest
 
Posts: n/a

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)
  #5  
Old July 23rd, 2005, 04:57 PM
McKirahan
Guest
 
Posts: n/a

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>


  #6  
Old July 23rd, 2005, 04:57 PM
Evertjan.
Guest
 
Posts: n/a

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compiler warning on ostream operator, Thomas Lenz answers 3 October 1st, 2008 01:55 PM
Pass Table as a parameter to a function ArunDhaJ answers 12 August 3rd, 2007 10:55 AM
Switch Within A Switch cytec123187@gmail.com answers 7 April 22nd, 2006 10:05 PM
Evaluation order of function parameters haroon answers 25 December 5th, 2005 05:35 AM
`void **' revisited: void *pop(void **root) Stig Brautaset answers 15 November 13th, 2005 09:42 PM