/    Sign up×
Community /Pin to ProfileBookmark

Scripting Help

[QUOTE]

// JavaScript Document
function NoRadioButtonChecked(grp)
{
var x, len = grp.length;
for(x=0; x<len; ++x)
if(grp[x].checked) break;
if(x<len) return false;
alert(“No radio button checked in the ‘” + grp[0].name + “‘ group.”);
grp[0].focus();
return true;
}

function Project()
{

if (NoRadioButtonChecked(Quiz.Background) return false;
if (NoRadioButtonChecked(Quiz.Mouse) return false;
if (NoRadioButtonChecked(Quiz.ctrl) return false;
if (NoRadioButtonChecked(Quiz.Mac) return false;
if (NoRadioButtonChecked(Quiz.leet) return false;
if (NoRadioButtonChecked(Quiz.cmd) return false;
if (NoRadioButtonChecked(Quiz.microsoft) return false;
if (NoRadioButtonChecked(Quiz.browser) return false;
if (NoRadioButtonChecked(Quiz.video) return false;
if (NoRadioButtonChecked(Quiz.quiz) return false;

var a1 = (Quiz.Background[2].checked) ? 1 : 0;
var b1 = (Quiz.Mouse[2].checked) ? 1 : 0;
var c1 = (Quiz.ctrl[0].checked) ? 1 : 0;
var d1 = (Quiz.Mac[0].checked) ? 1 : 0;
var e1 = (Quiz.leet[2].checked) ? 1 : 0;
var f1 = (Quiz.cmd[2].checked) ? 1 : 0;
var g1 = (Quiz.microsoft[3].checked) ? 1 : 0;
var h1 = (Quiz.browser[3].checked) ? 1 : 0;
var i1 = (Quiz.video[0].checked) ? 1 : 0;
var j1 = (Quiz.quiz[1].checked) ? 1 : 0;

var total = a1 + b1 + c1 + d1 + e1 + f1 + g1 + h1 + i1 + j1;

if (total == 0 || total == 1 || total == 2)
{
document.writeln(“You are a <h1><p>Novice.</h1></p><br> Your score was ” +total+ “…. You know absolutely nothing about computers”);
}
else
if (total == 3 || total == 4 || total == 5)
{
document.writeln(“You are an <h1><p>Intermediate.</h1></p><br> Your score was ” +total+ ” … You know some things about computers<p><a href=”Project 3.html”>Return to Home</a></p> “);
}
else
if (total == 6 || total == 7 || total == 8)
{
document.writeln(“You are an <h1><p>Expert.</h1></p><br> Your score was ” +total+ ” …You know almost everything about computers<p><a href=”Project 3.html”>Return to Home</a></p>”);
}
else
if (total == 9 || total == 10)
{
document.writeln(“You are a <h1><p>God.</h1></p><br> Your score was ” +total+ ” …You know everything there is to know about computers<p><a href=”Project 3.html”>Return to Home</a></p>”);
}

}

[/QUOTE]

I commented out this part.

[QUOTE]

if (NoRadioButtonChecked(Quiz.Background) return false;
if (NoRadioButtonChecked(Quiz.Mouse) return false;
if (NoRadioButtonChecked(Quiz.ctrl) return false;
if (NoRadioButtonChecked(Quiz.Mac) return false;
if (NoRadioButtonChecked(Quiz.leet) return false;
if (NoRadioButtonChecked(Quiz.cmd) return false;
if (NoRadioButtonChecked(Quiz.microsoft) return false;
if (NoRadioButtonChecked(Quiz.browser) return false;
if (NoRadioButtonChecked(Quiz.video) return false;
if (NoRadioButtonChecked(Quiz.quiz) return false;

[/QUOTE]

and the script ran fine, however, it didnt alert the user. Now when I get rid of the comments it doesnt run at all. So that means the code above was the problem. If anyone could help me out to tell me what is wrong. Thanks in advance.

to post a comment
JavaScript

6 Comments(s)

Copy linkTweet thisAlerts:
@phpnoviceJun 12.2006 — It also means there was an error message. Find it and fix it.
Copy linkTweet thisAlerts:
@RarablueauthorJun 12.2006 — there was no error message. Just when I clicked submit nothing happened. No error came up.

Oh wait, here we go. Line 17 Character 44 Expected "j"....

hmmm I'll be back!
Copy linkTweet thisAlerts:
@RarablueauthorJun 12.2006 — if there was a problem in the line that you called the javascript in your html. Does that mean the problem is in the javascript?
Copy linkTweet thisAlerts:
@phpnoviceJun 12.2006 — These are all missing a parenthesis:
if (NoRadioButtonChecked(Quiz.Background)[COLOR=Red][B])[/B][/COLOR] return false;
if (NoRadioButtonChecked(Quiz.Mouse)[COLOR=Red][B])[/B][/COLOR] return false;
if (NoRadioButtonChecked(Quiz.ctrl)[COLOR=Red][B])[/B][/COLOR] return false;
if (NoRadioButtonChecked(Quiz.Mac)[COLOR=Red][B])[/B][/COLOR] return false;
if (NoRadioButtonChecked(Quiz.leet)[COLOR=Red][B])[/B][/COLOR] return false;
if (NoRadioButtonChecked(Quiz.cmd)[COLOR=Red][B])[/B][/COLOR] return false;
if (NoRadioButtonChecked(Quiz.microsoft)[COLOR=Red][B])[/B][/COLOR] return false;
if (NoRadioButtonChecked(Quiz.browser)[COLOR=Red][B])[/B][/COLOR] return false;
if (NoRadioButtonChecked(Quiz.video)[COLOR=Red][B])[/B][/COLOR] return false;
if (NoRadioButtonChecked(Quiz.quiz)[COLOR=Red][B])[/B][/COLOR] return false;
Copy linkTweet thisAlerts:
@RarablueauthorJun 12.2006 — You Are A Genious. Thank You Soooooooooooooo Much!!!!!!!!!!!!!!!!
Copy linkTweet thisAlerts:
@phpnoviceJun 12.2006 — I just need an error message and what line of code is causing it. ?

You're welcome.

Cheers.
×

Success!

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