Results 1 to 3 of 3
- 02-18-2012, 09:57 PM #1
Member
- Join Date
- Feb 2012
- Posts
- 1
- Rep Power
- 0
Submit question scheme data into final score.(New to coding in general)
Hello, I am trying to do a question scheme for a school project. It's about an English grammar test. I have written 5 questions with two response options each. These options are made as radio buttons. The radio buttons works as intended. Every time you tick the right button you are granted one point. So you can at max get 5 points from the test. What i need is a way to submit these points by a button that ads the points together and says something like: You scored x/5 points. This is pretty basic stuff and it's possible some of my coding is more complicated than it should be. Hope you can help me. Here is two of the 5 questions so you can see what the basic structure looks like. Code here:
//Spørgsmål 4
function check()
{
document.getElementById("svar7").checked=true
}
function uncheck()
{
document.getElementById("svar7").checked=false
}
</script>
</head>
<body>
<form id="s4">
4. The old servant served the family________for 40 years.<br />
<input type="radio" name="colors" id="svar7" />loyally<br />
<input type="radio" name="colors" id="svar8" />loyal
</form>
<script type="text/javascript">
point=0+point;
//check();
a=document.getElementById("svar7").checked;
if (a){
point++;
}
//document.write("Dine point: "+point);
</script>
</body>
</html>
</br>
</br>
</br>
<script type="text/javascript">
//Spørgsmål 5
function check()
{
document.getElementById("svar10").checked=true
}
function uncheck()
{
document.getElementById("svar10").checked=false
}
</script>
</head>
<body>
<form id="s5">
The teacher,_________had graeat expectations to her stufddents, gave them much homework.<br />
<input type="radio" name="colors" id="svar9" />there<br />
<input type="radio" name="colors" id="svar10" />who
</form>
<script type="text/javascript">
point=0+point;
//check();
a=document.getElementById("svar10").checked;
if (a){
point++;
}
document.write("Your points: "+point);
</script>Last edited by august94; 02-18-2012 at 09:58 PM. Reason: More info about problem
- 02-18-2012, 09:59 PM #2
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7
Re: Submit question scheme data into final score.(New to coding in general)
Javascript != Java. I'd suggest finding a javascript forum to get better help.
- 02-19-2012, 07:31 AM #3
Similar Threads
-
General question about the forum
By KhachQuy in forum Suggestions & FeedbackReplies: 3Last Post: 05-09-2011, 03:44 AM -
submit data using ajax
By mrunal123 in forum Java ServletReplies: 2Last Post: 02-03-2011, 08:26 AM -
A general question
By wizar in forum New To JavaReplies: 6Last Post: 01-15-2011, 10:13 PM -
Submit jsp form data to java
By keanhoo168 in forum JavaServer Pages (JSP) and JSTLReplies: 3Last Post: 09-09-2010, 11:43 AM -
General Question about Java
By bayan in forum New To JavaReplies: 6Last Post: 05-26-2010, 11:16 AM


LinkBack URL
About LinkBacks

Bookmarks