I'd like to have an image appear after the student answers each short answer question correctly. I can't seem to get it to work properly. See code below.
Thanks!
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="javascript">
<!--
var score = 0;
var answer = new Array("1","2","3","4","5","6","7","8");
//Check and display score
function check(){
for(i=0;i<answer.length;i++){
if(document.myform.elements[i].value.toLowerCase()==answer[i]){
score++;
document.getElementById("showpicture1").style.visi bility="visible";
document.getElementById("showpicture2").style.visi bility="visible";
document.getElementById("showpicture3").style.visi bility="visible";
document.getElementById("showpicture4").style.visi bility="visible";
}else{
if(document.myform.elements[i].value!=""){
document.myform.elements[i].value="Wrong!";
document.getElementById("showpicture").style.visib ility="hidden";
}
}
}
alert(score + " out of " + answer.length + ".");
score = 0;
}
//-->
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<form name="myform" method="post" action="">
<table width="432" border="0" align="center">
<tr>
<td width="183">
<div align="center">
<p>1+0=
<input type="text" name="1" size="8" onBlur="check()">
</p>
<p><img src="../../Desktop/myschoolgoal/space_derby1.gif" width="185" height="167" style="visibility:hidden;" id="showpicture1"> </p>
</div>
</td>
<td width="106">
<div align="center">1+1=
<input type="text" name="2" size="8" onBlur="check()">
<p><img src="../../Desktop/myschoolgoal/space_derby1.gif" width="185" height="167" style="visibility:hidden;" id="showpicture2"> </p>
</div>
</td>
<td width="129">
<div align="center">1+2=
<input type="text" name="3" size="8" onBlur="check()">
<p><img src="../../Desktop/myschoolgoal/space_derby1.gif" width="185" height="167" style="visibility:hidden;" id="showpicture3"> </p>
</div>
</td>
</tr>
<tr>
<td width="183">
<div align="center">1+3=
<input type="text" name="4" size="8" onBlur="check()">
<p><img src="../../Desktop/myschoolgoal/space_derby1.gif" width="185" height="167" style="visibility:hidden;" id="showpicture4"> </p>
</div>
</td>
<td width="106">
<div align="center">1+4=
<input type="text" name="5" size="8" onBlur="check()">
<p><img src="../../Desktop/myschoolgoal/space_derby1.gif" width="185" height="167" style="visibility:hidden;" id="showpicture"> </p>
</div>
</td>
<td width="129">
<div align="center">1+5=
<input type="text" name="6" size="8">
</div>
</td>
</tr>
<tr>
<td width="183">
<div align="center">1+6=
<input type="text" name="7" size="8">
</div>
</td>
<td width="106">
<div align="center">1+7=
<input type="text" name="8" size="8">
</div>
</td>
<td width="129">
<div align="center">1+8=
<input type="text" name="9" size="8">
</div>
</td>
</tr>
</table>
<p align="center">Student ID
<input type="text" name="studentID">
<input type="submit" name="Submit2" value="Submit Answers">
<INPUT TYPE="button" VALUE="Check Score" onClick="check();">
</p>
</form>
<form name="form1" method="post" action="">
<input type="radio" name="radio" value="1" onclick="rocket()">
<img src="../../Desktop/myschoolgoal/space_derby1.gif" width="185" height="167" style="visibility:hidden;" id="showpicture">
</form>
<p> </p>
</body>
</html>
2 1710
hi,
i hope this is the solution
I'd like to have an image appear after the student answers each short answer question correctly. I can't seem to get it to work properly. See code below.
Thanks!
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="javascript">
<!--
var score = 0;
var answer = new Array("1","2","3","4","5","6","7","8");
//Check and display score
function check(){
for(i=0;i<answer.length;i++){
if(document.myform.elements[i].value.toLowerCase()==answer[i]){
score++;
document.getElementById("showpicture1").style.visi bility="visible";
document.getElementById("showpicture2").style.visi bility="visible";
document.getElementById("showpicture3").style.visi bility="visible";
document.getElementById("showpicture4").style.visi bility="visible";
}else{
if(document.myform.elements[i].value!=""){
document.myform.elements[i].value="Wrong!";
document.getElementById("showpicture").style.visib ility="hidden";
}
}
}
alert(score + " out of " + answer.length + ".");
score = 0;
}
//-->
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<form name="myform" method="post" action="">
<table width="432" border="0" align="center">
<tr>
<td width="183">
<div align="center">
<p>1+0=
<input type="text" name="1" size="8" onBlur="check()">
</p>
<p><img src="../../Desktop/myschoolgoal/space_derby1.gif" width="185" height="167" style="visibility:hidden;" id="showpicture1"> </p>
</div>
</td>
<td width="106">
<div align="center">1+1=
<input type="text" name="2" size="8" onBlur="check()">
<p><img src="../../Desktop/myschoolgoal/space_derby1.gif" width="185" height="167" style="visibility:hidden;" id="showpicture2"> </p>
</div>
</td>
<td width="129">
<div align="center">1+2=
<input type="text" name="3" size="8" onBlur="check()">
<p><img src="../../Desktop/myschoolgoal/space_derby1.gif" width="185" height="167" style="visibility:hidden;" id="showpicture3"> </p>
</div>
</td>
</tr>
<tr>
<td width="183">
<div align="center">1+3=
<input type="text" name="4" size="8" onBlur="check()">
<p><img src="../../Desktop/myschoolgoal/space_derby1.gif" width="185" height="167" style="visibility:hidden;" id="showpicture4"> </p>
</div>
</td>
<td width="106">
<div align="center">1+4=
<input type="text" name="5" size="8" onBlur="check()">
<p><img src="../../Desktop/myschoolgoal/space_derby1.gif" width="185" height="167" style="visibility:hidden;" id="showpicture"> </p>
</div>
</td>
<td width="129">
<div align="center">1+5=
<input type="text" name="6" size="8">
</div>
</td>
</tr>
<tr>
<td width="183">
<div align="center">1+6=
<input type="text" name="7" size="8">
</div>
</td>
<td width="106">
<div align="center">1+7=
<input type="text" name="8" size="8">
</div>
</td>
<td width="129">
<div align="center">1+8=
<input type="text" name="9" size="8">
</div>
</td>
</tr>
</table>
<p align="center">Student ID
<input type="text" name="studentID">
<input type="submit" name="Submit2" value="Submit Answers">
<INPUT TYPE="button" VALUE="Check Score" onClick="check();">
</p>
</form>
<form name="form1" method="post" action="">
<input type="radio" name="radio" value="1" onclick="rocket()">
<img src="../../Desktop/myschoolgoal/space_derby1.gif" width="185" height="167" style="visibility:hidden;" id="showpicture">
</form>
<p> </p>
</body>
</html>
Perfect! Thanks a million!
Ben
hi,
i hope this is the solution Sign in to post your reply or Sign up for a free account.
Similar topics
by: Norman Peelman |
last post by:
I have a script that outputs images directly using the 'image' functions.
I have googled quite a bit but cannot seem to find the correct method of
sending headers to keep the images from being...
|
by: Chris Nafziger |
last post by:
In my code to send email from VBScript, I use standard CDOSYS code similar to
the following:
With oMsg
Set .Configuration = oCon
.To = """Admin"" <admin@mycompany.com>"
.From =...
|
by: Peter Diedrich |
last post by:
The site design is pretty simple:
============================================
| Head |
============================================
| | ...
|
by: Geoff Cox |
last post by:
Hello,
I am still having problems - apologies if the answer is in previous
postings!
I now have, in the header,
<sctipt>
var myimages=new Array();
|
by: EdB |
last post by:
We are having an odd problem saving images. We capture customer signatures
on a Palm Pilot and save them as points on a graph. We are able to
reconstruct these points to display the signature,...
|
by: Jameson |
last post by:
Happy New Year, Everyone!
I am trying to figure out how to display a bunch of images (mainly
JPEGs, but possibly a few GIFs and PNGs as well) that are stored in a
local directory on the system....
|
by: stubbsie |
last post by:
Hi,
I have redesigned our official public government website in .net and it has
taken me a few months to redo. I have been the sole designer of the website
from its humble beginnning a few years...
|
by: stevenjs |
last post by:
Greeings, all,
Flash 8 has quiz templates which are coded for multiple choice, true/false, text statement, and matching types of questions, along with hotspots and probably anoher type I am...
|
by: rosaryshop |
last post by:
I'm working a jewelry/rosary design web site at http://www.rosaryshop.com/rosariesAndKits2.php.
As the user makes selections, it updates images of various parts, giving them a preview of the...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |