Page 1 of 1

Dynamically created javascript function question

Posted: Wed Apr 19, 2006 11:56 am
by mattcooper
Hi all... Hope you had a good Easter.

I'm using the following function to get a user to confirm deletion of a page:

Code: Select all

function confirmation() {
    var answer = confirm("Are you sure you want to delete this page?")
     if (answer){
              alert("Page will be deleted permanently");
			  window.location = "<? echo $_SERVER['PHP_SELF']."?PHPSESSID=".session_id()."&ezine_id=".$_GET['ezine_id']."&action=delete"; ?>";
					}
     else{
	 		  alert("Action cancelled");
			  //window.location = "<? echo $_SERVER['PHP_SELF']."?PHPSESSID=".session_id()."&ezine_id=".$_GET['ezine_id']; ?>";
         	        }
}
The call to this function goes in a link. What I am struggling with is how to get the JS function to specify which page to delete, perhaps by calling it thus: onClick="confirmation($page_id)".

Can anyone suggest how this may be possible?

Thanks in advance!