Nueric pad keys

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Davide

    Nueric pad keys

    Hello to everyone,
    do you know if it's possible (through a javascript in a HTML page) to
    intercept when the user press the "." (period) key of the numeric pad and
    replace it with a comma (italian "decimal point" is "comma" and I'm
    developing an intranet apllication for an italian customer)

    Thanks,
    Davide


  • Olexiy Merenkov

    #2
    Re: Nueric pad keys

    Hello, Davide!

    Here is the code:
    -----------------------
    <html>
    <head>
    <script language="javas cript">
    function CheckStr()
    {
    var f = document.myform .myedit.value;
    re=RegExp('[.]','gi');
    f=f.replace(re, ',');
    document.myform .myedit.value=f ;
    }

    </script>
    <body>
    <form action="" name="myform">
    <input type="text" name="myedit" onkeyup="CheckS tr();">
    <input type="submit">
    </form>
    </body>
    </html>
    -----------------

    Did it help you?


    Kindest Regards,
    Olexiy Merenkov


    [color=blue]
    > Hello to everyone,
    > do you know if it's possible (through a javascript in a HTML page) to
    > intercept when the user press the "." (period) key of the numeric pad and
    > replace it with a comma (italian "decimal point" is "comma" and I'm
    > developing an intranet apllication for an italian customer)
    >
    > Thanks,
    > Davide
    >
    >[/color]


    Comment

    • Davide R.

      #3
      Re: Nueric pad keys

      Thank you Olexiy,
      it works fine, but if I use the "period" key that is not on the numeric pad,
      the script write a comma.
      Do you know if it's possible to write a comma ONLY by pressing the period
      key on the numeric pad?

      (I can use Microsoft Internet Explorer specific features, because this is an
      intranet application used only with Internet Explorer)

      Thanks,
      Davide.




      Comment

      • Olexiy Merenkov

        #4
        Re: Nueric pad keys


        Sorry but I don't understand what is this 'period key'. If you mean comma
        that is up
        the spacebar, it work ok for me...
        [color=blue]
        > Do you know if it's possible to write a comma ONLY by pressing the period
        > key on the numeric pad?[/color]

        This code replaces commas after pressing the key so if you know undesired
        symbol code
        you can easily replace it by point '.' or with empty space ''

        -
        Kindest Regards,
        Olexiy Merenkov




        Comment

        • Olexiy Merenkov

          #5
          Re: Nueric pad keys


          Sorry but I don't understand what is this 'period key'. If you mean comma
          that is up
          the spacebar, it work ok for me...
          [color=blue]
          > Do you know if it's possible to write a comma ONLY by pressing the period
          > key on the numeric pad?[/color]

          This code replaces commas after pressing the key so if you know undesired
          symbol code
          you can easily replace it by point '.' or with empty space ''

          -
          Kindest Regards,
          Olexiy Merenkov




          Comment

          • Evertjan.

            #6
            Re: Nueric pad keys

            Olexiy Merenkov wrote on 10 aug 2003 in comp.lang.javas cript:[color=blue]
            > Sorry but I don't understand what is this 'period key'. If you mean comma[/color]

            In the US they say [for unknown reasons] "period" for "point",
            both meaning the "." character, Olexiy.

            So the "Period key" on the numeric pad is
            between the "0" and the "enter" on a US keyboard.

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

            Comment

            • Evertjan.

              #7
              Re: Nueric pad keys

              Olexiy Merenkov wrote on 10 aug 2003 in comp.lang.javas cript:[color=blue]
              > Sorry but I don't understand what is this 'period key'. If you mean comma[/color]

              In the US they say [for unknown reasons] "period" for "point",
              both meaning the "." character, Olexiy.

              So the "Period key" on the numeric pad is
              between the "0" and the "enter" on a US keyboard.

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

              Comment

              • Davide R.

                #8
                Re: Nueric pad keys

                >[color=blue]
                > So the "Period key" on the numeric pad is
                > between the "0" and the "enter" on a US keyboard.
                >[/color]

                Yes, also on an italian keyboard.
                But in Italy the "decimal point symbol" is not a point (".") but a comma
                (",").
                So, if in the USA people wrotes 1,000.50 (one thousand and 50 pennies), in
                Italy we usually wrote 1.000,50.
                Some programs (like italian version of Microsoft Access for example) write a
                comma when you press the "decimal point" of the numeric pad, but Internet
                Explorer doesn't do this (and I want to do this in my web application).

                Davide.


                Comment

                • Davide R.

                  #9
                  Re: Nueric pad keys

                  >[color=blue]
                  > So the "Period key" on the numeric pad is
                  > between the "0" and the "enter" on a US keyboard.
                  >[/color]

                  Yes, also on an italian keyboard.
                  But in Italy the "decimal point symbol" is not a point (".") but a comma
                  (",").
                  So, if in the USA people wrotes 1,000.50 (one thousand and 50 pennies), in
                  Italy we usually wrote 1.000,50.
                  Some programs (like italian version of Microsoft Access for example) write a
                  comma when you press the "decimal point" of the numeric pad, but Internet
                  Explorer doesn't do this (and I want to do this in my web application).

                  Davide.


                  Comment

                  • Evertjan.

                    #10
                    Re: Nueric pad keys

                    Davide R. wrote on 11 aug 2003 in comp.lang.javas cript:[color=blue][color=green]
                    >> So the "Period key" on the numeric pad is
                    >> between the "0" and the "enter" on a US keyboard.[/color]
                    >
                    > Yes, also on an italian keyboard.
                    > But in Italy the "decimal point symbol" is not a point (".") but a
                    > comma (",").[/color]

                    Then it is not a "decimal point" but a "decimal comma" ;-)
                    [color=blue]
                    > So, if in the USA people wrotes 1,000.50 (one thousand and 50
                    > pennies), in Italy we usually wrote 1.000,50.[/color]

                    Also here in the Netherlands
                    [color=blue]
                    > Some programs (like italian version of Microsoft Access for example)
                    > write a comma when you press the "decimal point" of the numeric pad,[/color]

                    Terrible.
                    [color=blue]
                    > but Internet Explorer doesn't do this (and I want to do this in my web
                    > application).[/color]

                    <input
                    onkeydown="if(e vent.keyCode==1 10){this.value+ =',';return false}"
                    style="font-size:30pt;">

                    This only works if the cursor is on the far right !!!

                    =============== ======

                    <input
                    onkeydown="this .value=this.val ue.replace(/\./g,',')"
                    onblur="this.va lue=this.value. replace(/\./g,',')"
                    style="font-size:30pt;">

                    This works for all points, but on the next key or blur.

                    =============== =======

                    Please warn your users beforehand !!!

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

                    Comment

                    • Evertjan.

                      #11
                      Re: Nueric pad keys

                      Davide R. wrote on 11 aug 2003 in comp.lang.javas cript:[color=blue][color=green]
                      >> So the "Period key" on the numeric pad is
                      >> between the "0" and the "enter" on a US keyboard.[/color]
                      >
                      > Yes, also on an italian keyboard.
                      > But in Italy the "decimal point symbol" is not a point (".") but a
                      > comma (",").[/color]

                      Then it is not a "decimal point" but a "decimal comma" ;-)
                      [color=blue]
                      > So, if in the USA people wrotes 1,000.50 (one thousand and 50
                      > pennies), in Italy we usually wrote 1.000,50.[/color]

                      Also here in the Netherlands
                      [color=blue]
                      > Some programs (like italian version of Microsoft Access for example)
                      > write a comma when you press the "decimal point" of the numeric pad,[/color]

                      Terrible.
                      [color=blue]
                      > but Internet Explorer doesn't do this (and I want to do this in my web
                      > application).[/color]

                      <input
                      onkeydown="if(e vent.keyCode==1 10){this.value+ =',';return false}"
                      style="font-size:30pt;">

                      This only works if the cursor is on the far right !!!

                      =============== ======

                      <input
                      onkeydown="this .value=this.val ue.replace(/\./g,',')"
                      onblur="this.va lue=this.value. replace(/\./g,',')"
                      style="font-size:30pt;">

                      This works for all points, but on the next key or blur.

                      =============== =======

                      Please warn your users beforehand !!!

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

                      Comment

                      • Davide R.

                        #12
                        Re: Nueric pad keys

                        >[color=blue]
                        > <input
                        > onkeydown="if(e vent.keyCode==1 10){this.value+ =',';return false}"
                        > style="font-size:30pt;">
                        >
                        > This only works if the cursor is on the far right !!![/color]

                        Great! It works
                        Any Idea when the cursor is not on the far right?

                        Davide.


                        Comment

                        • Davide R.

                          #13
                          Re: Nueric pad keys

                          >[color=blue]
                          > <input
                          > onkeydown="if(e vent.keyCode==1 10){this.value+ =',';return false}"
                          > style="font-size:30pt;">
                          >
                          > This only works if the cursor is on the far right !!![/color]

                          Great! It works
                          Any Idea when the cursor is not on the far right?

                          Davide.


                          Comment

                          • Steven Dilley

                            #14
                            Re: Nueric pad keys

                            "Davide R." <aaa@bb.com> wrote in message
                            news:bh7h0h$f2b $1@newsreader.m ailgate.org...[color=blue][color=green]
                            > >[/color]
                            > So, if in the USA people wrotes 1,000.50 (one thousand and 50 pennies), in
                            > Italy we usually wrote 1.000,50.[/color]

                            Actually, USA: 1,000.50 (one thousand and 50 pennies)
                            Italy: 1.000.000,50 (one million lira and a half)

                            Or roughly that much. I didn't check the latest conversion rate. ;-)

                            --
                            Steve

                            Comment

                            • Evertjan.

                              #15
                              Re: Nueric pad keys

                              Steven Dilley wrote on 11 aug 2003 in comp.lang.javas cript:
                              [color=blue]
                              > "Davide R." <aaa@bb.com> wrote in message
                              > news:bh7h0h$f2b $1@newsreader.m ailgate.org...[color=green][color=darkred]
                              >> >[/color]
                              >> So, if in the USA people wrotes 1,000.50 (one thousand and 50
                              >> pennies), in Italy we usually wrote 1.000,50.[/color]
                              >
                              > Actually, USA: 1,000.50 (one thousand and 50 pennies)
                              > Italy: 1.000.000,50 (one million lira and a half)
                              >
                              > Or roughly that much. I didn't check the latest conversion rate. ;-)[/color]

                              You heavily miss the point [or the comma], Steve:

                              Actually:

                              USA: 1,000.50

                              Italy: 1.128,36 (rate of 2 minutes ago)



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

                              Comment

                              Working...