Focus to same text box using javascript


I faced a problem in my project , then it was solved .When I pressed tab it should come to same text box at particular condition . I like to share that code .

sample code was

setTimeout("field_focus.focus()", 50);
<html>
<head>
<script type="text/javascript">
function focusMethod(id)
{

if (parseInt(id.value)="8)" {
field_focus = document.getElementById('entryField');
setTimeout("field_focus.focus()", 50);

}
}
</script>
</head>
<body>
<input id="entryField" name="entryField" OnBlur="focusMethod(this);">
</input>
</body>
</html>

Advertisements

About sathia

Web developer at cloudmint
This entry was posted in Web. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s