Set focus on a particular field in forms

1.how to set focus on a particular field when that field is not filled by a user ?

  1. how to use tab key for navigating to different fields ?

[php]

<?php if(isset($_GET['usernamefielderror'])){ //Variable passed back from form processing function through URL echo('');//text field with focus if set }else{ echo('');//text field without focus because its not set } ?> [/php]

You may want to identify it with ID instead of NAME.

  1. Tab index

tabindex=1

function checkForm(){
var x=document.forms[“myForm”][“myField”].value
if (x==null || x==""){
alert(“Name is required”);
document.getElementById(‘fieldID’).focus();
return false;
}
}

Label:

@thanxx codeguru …i found it very helpful .well explained :slight_smile:

Sponsor our Newsletter | Privacy Policy | Terms of Service