44 users online (0 members and 44 guests)  

Thread: i need help !!!


  Results 1 to 9 of 9
  1. #1
    raddadi's Avatar
    New User

    Status
    Offline
    Join Date
    Jan 2008
    Posts
    5

    i need help !!!

    hello every one :
    can any body help me with the multi choices exam in javascript, i need the code pleeeeeeeas

  2. #2
    rangana's Avatar
    Moderator/Allstar

    Status
    Offline
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    317

    Re: i need help !!!

    What's that?..An examination...or you want a JS code with regards to an "exam" like form
    I'm confused...could you show us what you've had so far

  3. #3
    raddadi's Avatar
    New User

    Status
    Offline
    Join Date
    Jan 2008
    Posts
    5

    Re: i need help !!!

    I want to work with random testing multi-choices so that each question has four choices

  4. #4
    rangana's Avatar
    Moderator/Allstar

    Status
    Offline
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    317

    Re: i need help !!!

    Could you show us how you've gone so far?
    ...Do you want to have a random question every when?..every load?...or something else

  5. #5
    raddadi's Avatar
    New User

    Status
    Offline
    Join Date
    Jan 2008
    Posts
    5

    Re: i need help !!!

    yeah thats it i want to have a random question every load.. sorry to confused you

  6. #6
    raddadi's Avatar
    New User

    Status
    Offline
    Join Date
    Jan 2008
    Posts
    5

    Re: i need help !!!

    var msg = new Array();
    Stamp = new Date();
    today = Stamp.getSeconds();
    msg[1] = " 1. We didn't want to get in trouble,______ we parked in the lot around the corner.<br><input type=radio>1-so<br><input type=radio>2-we";

    function writeTip() {
    document.write(msg[today]);
    }

  7. #7
    rangana's Avatar
    Moderator/Allstar

    Status
    Offline
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    317

    Re: i need help !!!

    This is a very basic example, see if it suite your needs
    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style type="text/css">
    #show {
        width:600px;
        line-height:30px;
        border:3px double #999;
        font-family:time,serif;
        font-size:16px;
        text-align:center;
        margin:20px auto;
     }
    </style>
    <script type="text/javascript">
    /*********************************************Edti values here*********************************************/
     var q1 = '1. We didn\'t want to get in trouble,______ we parked in the lot around the corner.<br><input type=radio>1-so<br><input type=radio>2-we';
     var q2 = '1. What\'s the next question by the way?________<br/><input type="radio">1-so<br/><inpug type="radio">2-we';
     var q3 = '1. Who is rangana?...__________________<br/><input type="text">';
     var q4 = '1. Lorem Ipsum right?...______________<br/><input typ0e="text">';
    /*********************************************************************************************************************/
     var questions = [q1,q2,q3,q4];
     
    window.onload=function() {
       num=Math.floor(Math.random()*questions.length);
       document.getElementById('show').innerHTML=questions[num];
     }
    </script>
    </head>
    <body>
    <div id="show">&nbsp;</div>
    </body>
    </html>
    ...Also, avoid using document.write, it will give you unpredictable results

    See if it helps

  8. #8
    raddadi's Avatar
    New User

    Status
    Offline
    Join Date
    Jan 2008
    Posts
    5

    Re: i need help !!!

    yes it works THANK YOU
    but why i can't use the <form> <input type=radio></form>

  9. #9
    rangana's Avatar
    Moderator/Allstar

    Status
    Offline
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    317

    Re: i need help !!!

    Who said it
    ....You can always affixed the radio buttons with the form tags, just place it inside the edit values comments in the script