Connecting Tech Pros Worldwide Help | Site Map

change comma to point in real-time?

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 23rd, 2005, 03:56 PM
Piotr
Guest
 
Posts: n/a
Default change comma to point in real-time?

Is it any way to change comma to point when it is typped into the INPUT
field?

  #2  
Old July 23rd, 2005, 03:56 PM
McKirahan
Guest
 
Posts: n/a
Default 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, 03:56 PM
Piotr
Guest
 
Posts: n/a
Default Re: change comma to point in real-time?

it's this, thank you!
  #4  
Old July 23rd, 2005, 03:56 PM
Evertjan.
Guest
 
Posts: n/a
Default 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, 03:57 PM
McKirahan
Guest
 
Posts: n/a
Default 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, 03:57 PM
Evertjan.
Guest
 
Posts: n/a
Default 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)
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,662 network members.