/    Sign up×
Community /Pin to ProfileBookmark

Calling two events at same time in form

Hi Could anyone help me plz.

I have a form in which 2 textbox, 1 check box and 1 reset button.

Now when i write something in the textbox 1 and click out side the textbox it automatically check my checkbox and after that when i click on the reset button then reset the form. Till this its working perfectly.

But now the main issue is this after write in textbox1 and checkbox is check then it must move the cursor focus to the 2 textbox. which it is not doing. I also used focus function but it is not working.

Below is the code. Please check tell me if i m not missing something in the code.
————————–

<script language=”javascript”>
function msgalert()
{
document.f1.cb1.checked=true;
document.f1.t2.focus();
}
</script>

<body> <br>
<form name=”f1″>
Name: <input type=”text” name=”t1″ onChange=”msgalert()”>
Check box:<input type=”checkbox” name=”cb1″>
<input type=”reset” name=”reset” value=”reset”><br>
<input type=”text” name=”t2″>
</form>
</body>

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@KorMar 22.2006 — use [B]onblur[/B] instead of [B]onchange[/B]
×

Success!

Help @Gaurav_Khanna spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.8,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...