By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,375 Members | 1,116 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,375 IT Pros & Developers. It's quick & easy.

i want to display the radio button value in the table when selected that means if the

P: 1
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html> <html> <head> <script type="text/javascript">     var holdPrevesScore=0;//holds evaluation of pervious person.      function sumOfEvaluation(form) {         var control, controls = form.elements;          var radios;           var totalScore = 0;     for (var i=0, iLen=controls.length; i<iLen; i++) {                  control = controls[i];           if ((control.type == 'radio') && control.checked) {                   var Score=Number(control.value);                   addrow(score,i);                 }                          }                }          function addrow(var scr, var indx){     var radioCount=0;     var newValue=scr;     var d=scr;     //creating element     var newTR = document.createElement("tr");     newTR.id = "tr" + ++radioCount;     var newTD1 = document.createElement("td");     var newTD2 = document.createElement("td");     var newTD3 = document.createElement("td");     var newTD4 = document.createElement("td");      var newTD5 = document.createElement("td");     var newTD6 = document.createElement("td");      var newTD7 = document.createElement("td");    // creating text nodes     var qustion_NO = document.createTextNode(indx);     var excellent = document.createTextNode(newValue);     var veryGood = document.createTextNode(newValue);     var good = document.createTextNode(newValue);     var satisfactory = document.createTextNode(newValue);     var poor = document.createTextNode(newValue);     var unknown = document.createTextNode(newValue);     // appending text node to elements       newTD1.appendChild(qustion_NO);        newTD2.appendChild(excellent);        newTD3.appendChild( veryGood);        newTD4.appendChild( good);        newTD5.appendChild(satisfactory);        newTD6.appendChild( poor);        newTD7.appendChild(unknown);       //append child th to element newTR       newTR.appendChild(newTD1);       newTR.appendChild(newTD2);        newTR.appendChild(newTD3);       newTR.appendChild(newTD4);       newTR.appendChild(newTD5);        newTR.appendChild(newTD6);       newTR.appendChild(newTD7);     //Insert new row at end of table.      var table = document.getElementById("dbRowsTable");      table.appendChild(newTR);            }              </script> </head> <body bgcolor="00FF66"> <center> <table id="dbRowsTable" border="1"> <tr><th>QUESTION NO</th><th>EXCELLENT</th><th>VERY GOOD</th><th>GOOD</th><th>SATISFACTORY</th><th>POOR</th><th>UNKNOWN</th></tr> </table> </center><br><br><hr><hr> <form name="quiz"> <h2><b>PART A </b></h2> <h3>THE INSTRUCTER </h3>                1.provides course outline &a relevant handouts that reflect the major content areas of the course in accordance with the catalog description and clearly defines objectives and expectations.                                           <ol> <input type="radio" name="q1" value="1">5                           <input type="radio" name="q1" value="0.75">4                            <input type="radio" name="q1" value="0.5">3                            <input type="radio" name="q1" value="0.25">2                            <input type="radio" name="q1" value="0.1">1                            <input type="radio" name="q1" value="0">N<br> </ol>                   2.Adequately covers the materials referenced in the online and explains how topics being discussed relate to the course objectives                   <ol> <input type="radio" name="q2" value="1">5                           <input type="radio" name="q2" value="0.75">4                            <input type="radio" name="q2" value="0.5">3                            <input type="radio" name="q2" value="0.25">2                            <input type="radio" name="q2" value="0.1">1                            <input type="radio" name="q2" value="0">N                         </ol>               3. presents course materials which are challenging and which forces students to work at maximum potential                        <ol> <input type="radio" name="q3" value="1" >5                           <input type="radio" name="q3" value="0.75" >4                            <input type="radio" name="q3" value="0.5" >3                            <input type="radio" name="q3" value="0.25" >2                            <input type="radio" name="q3" value="0.1" >1                            <input type="radio" name="q3" value="0" >N                         </ol> <input type="button" value="TOTAL EVALUATION" onClick="sumOfEvaluation(this.form);"> <input type="reset" value="CLEAR EVALUATION"><br><br> </form> </body> </html>
Jan 26 '16 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.