/    Sign up×
Community /Pin to ProfileBookmark

I am writing my code here, it works but doesn’t exactly show the result I want.
when I click submit button it shows the result in location bar and I want it to show the result in one of the form field named windch. I am new to javascript, please help!!!
Thanks a million in advance.

<html>
<head>
<script language=”Javascript”>
function calc(){
document.form1.windch.value = document.form1.outtemp.value – (document.form1.wind.value * 1.5);
if (document.form1.windch.value >= -10) {
document.form1.temp[0].checked = true
}

else if (document.form1.windch.value >= -20) {
document.form1.temp[1].checked = true
}

else {
document.form1.temp[2].checked = true
}

}
</script>
</head>
<body>
<form onSubmit=”calc()” name=”form1″>
<input type=text name=”outtemp”><br>
<input type=text name=”wind”><br>
<input type=text name=”windch”><br>
<input type=radio name=temp value=beautiful>Beautiful skiing weather<br>
<input type=radio name=temp value=warm>Dress warm for skiing today<br>
<input type=radio name=temp value=frost>Possibility of frost bite<br>
<input type=submit value=submit>

</form>

</body>
</html>

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @manurup 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.18,
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,
)...