Hi there,

I am totally new in javascript and i need a help because i dont know how to create script that confirm the user's choice and submit it to the parent page before the parent page make a process.

like this.

i have a page that shows the details of a certain module and there is a choice there to edit and delete the module.

if the user choose to delete that module, a window will pop up asking if the user is sure to delete that module.

if the user select no.. the pop up window will close and the parent page stay on the current page.

but if the user choose yes.. the pop up window will close and the parent window will be redirected to the process page which will process the deletion of the module.

other option is to have the command on pop up window that if the yes button is clicked, the pop up window will close and redirect the parent page to the process page.

i dont know where to start so please help me brothers.

Thanks a lot in advance.. please help. thank you..

Recommended Answers

All 3 Replies

You could use something like this:

<a href="delete.php" onclick="return confirm('Are you sure you want to delete?')">Delete</a>

Oh gosh master. i didn't know my problem is that easy.. I'm really thankful to you..

Thanks a lot.. God bless you..

I am hoping that you can help me in my future projects.. thanks a lot..

Separating the javascript code into a function, then call that within the link worked for me. Example:

function confirmLinkAction(){
      var confirmed = confirm("Are you sure? This will remove this entry forever.");
      return confirmed;

And the link:

<a href="http://goingsomewhere.php" onclick="return confirmLinkAction()">Click me to see pop up</a>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.