Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

reload page from a confirm box

Status
Not open for further replies.

vlitim

Programmer
Sep 2, 2000
393
GB
function askData() {

var msg = "Sure you want Delete this record?";

if (confirm(msg))
window.location = "newpage.htm";
else
alert("ok");

}

<a href=&quot;#&quot; onclick=&quot;askData();&quot;>click here</a>


I can't get it so when someone clicks ok in the confirm box they are sent to a new page!? Any help would be most appreciated!
 
var msg = &quot;Sure you want Delete this record?&quot;;

if (confirm(msg))
window.location = &quot;newpage.htm&quot;;
else
alert(&quot;ok&quot;);
return false;<----------//use this

}

<a href=&quot;#&quot; onclick=&quot;askData();&quot;>click here</a>


 

Tried this when you click ok it still does nothing at all! It recognises that you have pressed ok, but will not load the specified page. Is there a problem with doing this in a new window? Because I am opening a new window then getting them to &quot;click here&quot; straight away!?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top