/    Sign up×
Community /Pin to ProfileBookmark

Radio buttons Check/Not Check Default check

I’m trying to report the values of the radio button called flavor,
I must show on a new page the name of the radio button, the value of each radio button, the radio button that was checked at load time and the radio button checked by the user. I tried using a for with 3 if statements for check, not check or default check but it didnt work so i did 2 functions 1 for check and the other for defaultcheck, the problem is just one function works and the other one gives me an error. I would appreciate help.

Thank you!

I show the HTML now thanx Khalil

HTML>
<HEAD>
<TITLE>Ice Cream Shop Order Form
</TITLE>
<SCRIPT LANGUAGE= “JavaScript”>
<!—
function radioCheck()
{
var counter;
for (counter=0; counter<5; counter++)
{
if (document.form1.flavor[counter].checked)
{
document.write (document.form1.flavor[counter].value);
document.write (” “);
document.write (“Checked by User”);
}
}

}

function radioDefault()
{
var count;
for (count=0; count<5; count++)
{
if (document.form1.flavor[count].defaultChecked)
{
document.write (document.form1.flavor[count].value);
document.write (” “);
document.write (“Checked at load time”);
}
}

}

function edit()
{

radioCheck ();
radioDefault();
}
—>

// I call the function edit here
<INPUT TYPE= “button” VALUE= “Edit and Report” NAME= “butcheck” onclick=”edit()”>
</FORM>
</BODY>
</HTML>

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@Khalid_AliOct 01.2003 — One tip...try not using document.write..

second show us the HTML part that how are you calling the code above....
×

Success!

Help @Rowena 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.19,
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,
)...