cidlockie
12-04-2003, 04:54 AM
I honestly couldn't think of a descriptive enough subject line so I'm sorry if that's a bit pitiful for this, but I hope someone can help.
Brief as I can: I have a site which basically shows snippets of dialogue from various movies, and asks readers to guess the film in an input box. A script checks the guess and if it's right it changes a standard image to the film's actual poster (thus showing the reader they've got the answer right).
Here's one of the individual films' sections...
<P align="center">"Give me that pistol, Mister."
<BR>"Huh?"
<BR>"I says give me over your pistol."
<BR>"Well, I ain't drunk."
<BR>"Ordinance says you got to turn in your firearms to the county office, day or night. I guess you didn't see the sign with the weather and all."
<BR>"No. But I ain't...I ain't armed."
<BR>"What about your friends upstairs? They got any pistols?"
<BR>"I don't know. No, I guess...No. They ain't armed either."
<BR>"Uh-huh. Spilled your whiskey?"
<BR>"Look, I said-"
<BR>"What's your name?"
<BR>"William Hendershot."
<BR>"Well, Mister William Hendershot, what if I was to say you was a no good son of a ***** and a liar?"</P>
<BR CLEAR=left>
<script type="text/javascript">
var pic62guess = "UNFORGIVEN"
function checkbj(){
frm=document.f62;
wk=frm.tbj.value.split('\r');
ln = wk.length;
for (var i=0; i<ln; i++) {
wk[i]=wk[i].replace(/ /g, '');
}
frm.tbj.value=wk.join('\r');
frm.tbj.value=frm.tbj.value.toUpperCase()
if(frm.tbj.value==pic62guess){
document.images["picbj"].src = pic62guess + ".jpg"
}
else {
alert("Incorrect. Please try again.");
frm.tbj.value="";
frm.tbj.focus();
}
}
</script>
<P align="center"><form name="f62" onSubmit="return false">
Save Heather - name the film<br>
<img name="picbj" src="heather.jpg"><br>
<input type="text" name="tbj"><br>
<input type="button" value="Go" onclick="checkbj()">
</form></P>
It's reasonably good fun, I'm told...but what it lacks is a way to calculate scores.
So, what I need to do is somehow find a script which adds up the number of correct guesses on a page and displays the total somewhere, at the bottom or the top or in a box when you click 'Calculate score' or anything like that.
I don't know whether I would be best to add up the number of images which have switched from 'heather.jpg' to the correct one, or to use some function to calculate the number of times the check function has been correctly employed on a page. And to be honest, I'd be pretty unsure where to start with either.
If anyone has a clue where I might begin with this it would be a great help, and just in case it helps in any way (and please do delete this if it's breaking protocol somehow) the address of the site is http://www.geocities.com/cidlockie/films/filmlist.htm
Thanks very much,
Chris.
Brief as I can: I have a site which basically shows snippets of dialogue from various movies, and asks readers to guess the film in an input box. A script checks the guess and if it's right it changes a standard image to the film's actual poster (thus showing the reader they've got the answer right).
Here's one of the individual films' sections...
<P align="center">"Give me that pistol, Mister."
<BR>"Huh?"
<BR>"I says give me over your pistol."
<BR>"Well, I ain't drunk."
<BR>"Ordinance says you got to turn in your firearms to the county office, day or night. I guess you didn't see the sign with the weather and all."
<BR>"No. But I ain't...I ain't armed."
<BR>"What about your friends upstairs? They got any pistols?"
<BR>"I don't know. No, I guess...No. They ain't armed either."
<BR>"Uh-huh. Spilled your whiskey?"
<BR>"Look, I said-"
<BR>"What's your name?"
<BR>"William Hendershot."
<BR>"Well, Mister William Hendershot, what if I was to say you was a no good son of a ***** and a liar?"</P>
<BR CLEAR=left>
<script type="text/javascript">
var pic62guess = "UNFORGIVEN"
function checkbj(){
frm=document.f62;
wk=frm.tbj.value.split('\r');
ln = wk.length;
for (var i=0; i<ln; i++) {
wk[i]=wk[i].replace(/ /g, '');
}
frm.tbj.value=wk.join('\r');
frm.tbj.value=frm.tbj.value.toUpperCase()
if(frm.tbj.value==pic62guess){
document.images["picbj"].src = pic62guess + ".jpg"
}
else {
alert("Incorrect. Please try again.");
frm.tbj.value="";
frm.tbj.focus();
}
}
</script>
<P align="center"><form name="f62" onSubmit="return false">
Save Heather - name the film<br>
<img name="picbj" src="heather.jpg"><br>
<input type="text" name="tbj"><br>
<input type="button" value="Go" onclick="checkbj()">
</form></P>
It's reasonably good fun, I'm told...but what it lacks is a way to calculate scores.
So, what I need to do is somehow find a script which adds up the number of correct guesses on a page and displays the total somewhere, at the bottom or the top or in a box when you click 'Calculate score' or anything like that.
I don't know whether I would be best to add up the number of images which have switched from 'heather.jpg' to the correct one, or to use some function to calculate the number of times the check function has been correctly employed on a page. And to be honest, I'd be pretty unsure where to start with either.
If anyone has a clue where I might begin with this it would be a great help, and just in case it helps in any way (and please do delete this if it's breaking protocol somehow) the address of the site is http://www.geocities.com/cidlockie/films/filmlist.htm
Thanks very much,
Chris.