| View previous topic :: View next topic |
| Author |
Message |
paulf
Joined: 19 May 2007 Posts: 12
|
Posted: Sun May 25, 2008 10:33 pm Post subject: alert box alternative please |
|
|
Hi guys I currently have this code in the middle of a piece of training software that i am putting together that does exactly what it says. If all the answers are correct an aleret box is displyed with the contained message.
Now, when the user clicks the button the box dissapears and nothing else happens but I want something to happen. I want the click of the button to remove alert box and advance to next page in the training software.
| Code: |
function everythingIsCorrect()
{
alert('Well done! You answered them all correctly.');
} |
I have tried all sorts but everything I do interupts the drag and drop script that causes the alert box in the event of dragging and dropping all the correct answers.
Any thoughts would be very much appreciated
Paul |
|
| Back to top |
|
 |
|
|
vurentjie
Joined: 25 May 2008 Posts: 6
|
Posted: Mon May 26, 2008 1:40 am Post subject: Re: alert box alternative please |
|
|
what you are looking for is return false; return true;
basically return false; will halt the regular flow of the argument.
also try changing your alert box to a prompt or something.....
ok, i just did a little search, first site that came up
all that you are asking for
[url]
http://www.shiningstar.net/articles/articles/javascript/confirmsubmit.asp[/url] |
|
| Back to top |
|
 |
paulf
Joined: 19 May 2007 Posts: 12
|
Posted: Mon May 26, 2008 2:20 pm Post subject: Re: alert box alternative please |
|
|
hi thanks for the reply .. I have taken a look at that site and maybe I am not understanding what you see but I couldn't find anything that I could use. I have VERY limited knowledge with coding so it is probable that I am missing it.
All I want to do is to find a way to move onto the next page when all the answers have been answered correctly from the current page.
The alert box offers an OK button. Can this button be coded to go to the next page? For example:
| Code: |
AnswersAllCorrect()
{
alert('Well done! You answered all the questions correctly. Go to the next page.');
<a href="NextPage.htm";
} |
It doesn't have to be an alert. It just needs to be an event triggered by AnswersAllCorrect() and go to next page in a very user friendly fashion!
An alternative to this could be to code a button that will go to next page in certain circumstances. ie:
| Code: |
<input type="button" value="Next Page" />
onclick{
if AnswersAllCorrect=TRUE
"NextPage.htm";
else
alert('Sorry you didn't get all the answers right!');
} |
This si an example ... I am not suggesting that this code got any chance of working. I am basically turning my english into code for demonstration.
Cheers |
|
| Back to top |
|
 |
vurentjie
Joined: 25 May 2008 Posts: 6
|
Posted: Mon May 26, 2008 3:43 pm Post subject: Re: alert box alternative please |
|
|
try this
| Code: |
<html>
<head>
<script type='text/javascript'>
function gotonextPage(gohere){
//could also add this and check answer here - otherwise just use option one or two
//if (answers()=="wrong")
//{return false;}
//}else{
//option 1 -if you just need to go to next page without anything else
//alert("Well done all answers correct");
//neWin = window.open(gohere,"_self");
//newWin.focus();
//add return true here if you want page to do something else as well
//option 2 -if you want to post your form contents and retrieve them on next page
//alert("Well done all answers correct");
//alert("Well done all answers correct");
//document.forms.myanswers.submit();
//}
}
</script>
</head>
<body>
<form name='myanswers' method='post' action='pageurl'>
<input type='button' onclick='gotonextPage("pageurl")' value='Submit answer' name='answers' >
</form>
</body>
</html>
|
|
|
| Back to top |
|
 |
|