• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

back button,confirm dislog issue

 
Ranch Hand
Posts: 336
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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??
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 336
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey! Thanks,Rama. That works.
 
reply
    Bookmark Topic Watch Topic
  • New Topic