Loading ...
Sorry, an error occurred while loading the content.
 

Re: [JavaScript] Firefox/Mozilla focus problem

Expand Messages
  • f3l
    ... ok, i ll give you that. The problem is the logical sequence ... that s weird, i get false on IE6 and true on ffx 1.5, sinse you sem to be trying to act
    Message 1 of 4 , Jun 5, 2006
      On 6/4/06, Mv Mv <mvlixo@...> wrote:
      >
      > Sry but you didnt understand the problem.
      >
      > My problem isnt on keycode, that works on both browsers.
      >

      ok, i'll give you that.

      The problem is the "logical sequence"
      >
      > i think onblur should be activated BEFORE onkeypress. as long as you press
      > enter, focus should go to field 2, and blur bring it back to field 1.
      >
      > Thats not whats happening tough on mozilla. Mozilla seems to play all
      > events
      > at the same time and state. If you set as in this case, a focus to another
      > element, the onblur event should be activated after the keypress event and
      > with keypress variables.
      >
      > also try
      >
      > <html>
      >
      > <script>
      >
      > var test = false
      >
      > function teste(event) {
      > alert(test);
      > }
      >
      > function teste2(event){
      > test = true;
      >
      > }
      > </script>
      >
      > <input type='text' ID='bla' size=10 maxlength=3 onblur='teste(event);'
      > onkeypress='teste2(event);'>
      > <input type='text' ID='ble' size=10 maxlength=3>
      >
      > </html>
      >
      >
      > the expected result shoul be "true", but on mozilla its false.
      >

      that's weird, i get "false" on IE6 and true on ffx 1.5,
      sinse you sem to be trying to act upon the user's "enter" key, you should
      consider attaching your code to onSubmit, maybe.


      Thanks
      >
      > Marcus
      >
      > 2006/6/3, f3l <auditor400@...>:
      >
      > >
      > > On 6/2/06, Mv Mv <mvlixo@...> wrote:
      > > >
      > > > Hey folcs
      > > >
      > > > Ive got a simple code that works in IE and doesnt work in mozilla.
      > here
      > > it
      > > > is
      > > >
      > > > <html>
      > > >
      > > > <script>
      > > >
      > > > function teste(event) {
      > > > document.getElementById('bla').focus();
      > > > }
      > > >
      > > > function teste2(event){
      > > > if (event.keyCode == 13) {
      > > >
      > >
      > > IE's event model is based n an early draft not the actual W3C spec,
      > > you should use charCode, (i think),when Gecko based, and keyCode
      > > otherwise,
      > > please, read the manual.
      > >
      > > document.getElementById('ble').focus();
      > > > }
      > > > }
      > > > </script>
      > > >
      > > > <input type='text' ID='bla' size=10 maxlength=3 onblur='teste(event);'
      > > > onkeypress='teste2(event);'>
      > > > <input type='text' ID='ble' size=10 maxlength=3>
      > > >
      > > > </html>
      > > >
      > > >
      > > > The expected is, when im on bla and press "enter" focus should go to
      > > field
      > > > "ble" and come back to "bla"
      >

      would you mind telling us, for how long does the focus stay in "BLE" ?
      is this some kind of validation stuff, so you can annoy users and say stuff
      like "thats not a number,pal" ?

      > >
      > > > On firefox however, it doesnt. Focus stays on field "bla". I think
      > this
      > > > shouldnt be the correct behaviour. should it?
      > > >
      > > > Anyone knows a workarround for this ? or something ?
      > > >
      > >
      > > ditch IE
      > >
      >

      WHAT the hell was i saying?
      EMBRACE IE, and all it's quirks, bugs and vulneravilities.
      so, 2 browsers dont work exactly the same,,,,, what else is new.

      > Thanks and sry for poor english
      > > >
      > > > Marcus
      > > >
      > > >
      > > >
      > > --
      > > //f3l
      > > http://www.geocities.com/kyoosho/
      > >
      >


      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.