Jump to content

[SOLVED] confirmation OK or CANCEL has the same result in ALL cases ?


programguru

Recommended Posts

i am unable to get this function i created to work properly. no matter what option i choose OK or CANCEL, the same result happens! I've tried many options to no avail? Anyone have any idea what the h%$# is wrong here?

 

function confirmation() {
var answer = confirm("Go somewhere else?")
if (answer){
	alert("Ok bye!")
	window.location = "REDIRECT-TO-ANOTHERPAGE.php";
}
else {
	alert("Thanks for sticking around!");
	window.location = "SHOULD-STAY-THE-SAME-PAGE.php";
}
}

 

Here is the link and function call:

 

<a onclick="confirmation()" href="review_edit_special.php">Edit</a>

 

SOS!!

Is it not possible to do an href link? I don't like clunky buttons, and the code was partly given to me from my brother, so I am not sure where it is all from.

 

Looks like you were referring to tizag's tutorial on Confirm.  What's the point of calling the function on the href link?  Why don't you do a button?

 

<input type="button" onclick="confirmation()" value="Edit">

 

I resolved the issue.

 

The script I was working with was overkill for my purposes.

 

I just created a function with one arg (address) and an if leading back to the address if canceled, and continuing to the new link if OK in the confirm.

 

Thanks for your help anyways..

 

SOLVED!!

 

 

 

 

 

Looks like you were referring to tizag's tutorial on Confirm.  What's the point of calling the function on the href link?  Why don't you do a button?

 

<input type="button" onclick="confirmation()" value="Edit">

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.