This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes back button,confirm dislog issue Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "back button,confirm dislog issue" Watch "back button,confirm dislog issue" New topic
Author

back button,confirm dislog issue

Pradeep Adibatla
Ranch Hand

Joined: Oct 27, 2009
Posts: 336
I have a button like this...



On click I want to give a confirm dialog as YES/NO...

YES---> to go back
NO-----> to stay in same page...


and the Javascript is :-->
-----------------------------



Nothing is happening ,,,what should be the change??
Ramasamy Anbalagan
Greenhorn

Joined: Dec 14, 2009
Posts: 20
Hi Pradeep,

You can use below code,

<html>

<SCRIPT language=JavaScript>
function goback(){
var confrm=confirm("Do you want to delete?");
if(confrm==true){
//alert('hai');
history.go(-1);
}
}
</SCRIPT>

<body>
<A HREF="javascript:goback()">Click here to go back to previous page</A>
<body>

<html>
Pradeep Adibatla
Ranch Hand

Joined: Oct 27, 2009
Posts: 336
Hey! Thanks,Rama. That works.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: back button,confirm dislog issue
 
Similar Threads
spaces while populating using s:iterator
How to submit struts form based on user confirmation through javascript
using OGNL
Yes or No Confirmation alert Msg Box??
TRacking event.returnValue in IE