Forum Moderators: open
I do realise that this is not the most user friendly way, but my friend does insist having this.
function confirmation(){
var answer = confirm("Do you wish to continue?")
if (answer){
window.location = "http://www.mydomain.com/form.html";
}
else{
window.location = "http://www.mydomain.com";
}
}
Any help would be appreciated.
Billy
I'm using the script below which displays a confirmation message when this form page is loaded. Using this script as is will loop if they agree, I’m not an experienced programmer so I would like some help to add some function to it so it will not loop but will display the confirmation message once when visited.
If the user wishes to continue they will be shown the form page, if they disagree they will be sent to the home page.
I do realise that this is not the most user friendly way, but my friend does insist having this.
JavaScript
function confirmation(){
var answer = confirm("Do you wish to continue?")
if (answer){
window.location = "http://www.mydomain.com/form.html";
}
else{
window.location = "http://www.mydomain.com";
}
}
html
<body id="test" onLoad="confirmation()">
<form action="" method="post" name="test" id="test">
<fieldset>
<legend>About You</legend>
<p>
<label>Firstname</label><br />
<input name="fname" type="text" id="fname">
</p>
<p><label>Surname</label><br />
<input name="sname" type="text" id="sname">
</p>
<p>
<label>Email</label><br />
<input name="email" type="text" id="email">
</p></fieldset>
<input type="submit" name="Submit" value="Submit">
</form>
</body>
Thanks in advance for any help on this
Billy