[Javascript] onBlur & onFocus together

Eligio Morgado eligio at gmail.com
Fri Feb 18 06:27:28 CST 2005


Hi Iztok.

I think you don't have to check onfocus event. Just onblur.

Let me explain:

<script>
  function fValidate( element )
  {
    // Example: Check for some text
    if( element.value == "" )
    {
       element.focus( );
    }
  }
</script>

and your input text:

<input type="text" name="txtMyText" onblur="javascript:fValidate(this);" />

On Fri, 18 Feb 2005 13:14:39 +0100, Iztok Polanic
<iztok.polanic at amis.net> wrote:
> Hi!
> 
> I'm building a web form. I'm using a onBlur event to check if the string
> is correct. Otherwise it should go back to that field (via onFocus).
> Strange thing is, that I'm trapped in a loop. Why is this happening and
> how to solve this?
> 
> --
> Bye,
> 
> Iztok
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>



More information about the Javascript mailing list