TextField focus and select all





<html>

<head>

<script language="JavaScript">

<!–

function checkField(formName)  {

  if (formName.f1.value != "Joe") {

     document.forms[0].f1.focus();

     document.forms[0].f1.select();

  }

}

//–>

</script>

</head>

<body>

<form>

<pre>

Field1 <input name="f1" onBlur="checkField(this.form)"><br>

Field2 <input name="f2">

</pre>

</form>

</body>

</html>



           

       

Tags: , , , , ,

Leave a Reply