SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict ghostme's Avatar
    Join Date
    Feb 2005
    Posts
    371
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    disable radio buttons in a group

    Hello good pple of the forum, I made a quiz using radio, grouped with different names, my problem is that, I want a situation at which the visitor that takes the test will not be able to change the answer of an already answered question.
    <script>
    function showscore()
    {
    var one=0,onee=0;two=0,twoo=0,three=0,threee=0,four=0,fourr=0,five=0,fivee=0;

    if(document.form1.msword[0].checked==true)
    {one=document.form1.msword[0].value;
    one=++onee;
    }
    if(document.form1.excel[1].checked==true)
    {two=document.form1.excel[1].value;
    two=++twoo;
    }
    if(document.form1.powerpoint[2].checked==true)
    {three=document.form1.powerpoint[2].value;
    three=++threee;
    }
    if(document.form1.access[1].checked==true)
    {
    four=document.form1.access[1].value;
    four=++fourr;
    }

    if(document.form1.frontpage[3].checked==true)
    {
    five=document.form1.frontpage[3].value;
    five=++fivee;}
    if(one+two+three+four+five<2){
    alert(one+two+three+four+five+" point");}
    else{
    alert(one+two+three+four+five+" points");
    }
    }
    }
    <form name="form1">
    1.what is msword?
    <input type="radio" name="msword" value=0>a word processor
    <input type="radio" name="msword" value=0>a graphic package
    <input type="radio" name="msword" value=0>a spreadsheet application
    <input type="radio" name="msword" value=0>a presentation package<br/>
    2.What is msexcel?
    <input type="radio" name="excel" value=0>a presentation package
    <input type="radio" name="excel" value=0>a spreadsheet application
    <input type="radio" name="excel" value=0>a web design tool
    <input type="radio" name="excel" value=0>a mail client<br/>
    3.What is mspowerpoint?
    <input type="radio" name="powerpoint" value=0>an accounting package
    <input type="radio" name="powerpoint" value=0>a content management system
    <input type="radio" name="powerpoint" value=0>a presentation package
    <input type="radio" name="powerpoint" value=0>a spreadsheet application<br/>
    4.What is msaccess?
    <input type="radio" name="access" value=0>an animation tool
    <input type="radio" name="access" value=0>a database mgt tool
    <input type="radio" name="access" value=0>a markuplanguage
    <input type="radio" name="access" value=0>a compiler<br/>
    5.What is Frontpage?
    <input type="radio" name="frontpage" value=0>a serverside language
    <input type="radio" name="frontpage" value=0>a time management software
    <input type="radio" name="frontpage" value=0>a hit counter
    <input type="radio" name="frontpage" value=0>web design and development tool</pre>
    <br/>
    <input type="button" onclick="showscore ();" value="checkscore">
    </form>
    Thanks for the help

  2. #2
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What happens if they click the wrong one by accident?
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.

  3. #3
    SitePoint Addict ghostme's Avatar
    Join Date
    Feb 2005
    Posts
    371
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    so obviosly i can't this done with JavaScript?

  4. #4
    SitePoint Addict
    Join Date
    May 2004
    Location
    Europe
    Posts
    216
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do you mean that you want to disable the whole radio group once one of the buttons was clicked, or what?

  5. #5
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh, it can be done. I'm saying that your reasons don't make sense.
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •