"Hal Halloway" <Ha******@nospam.net> skrev i meddelandet
news:0o4Ld.2767$zb.2094@trnddc07...
Newbie looking for the way have a dialog box and when a user goes to
this page they see *nothing*, Except for a dialog box pop, the box says:
"are you sure?" Yes/No. If user clicks yes they see the rest of the page
- (just some simple html). Else no, they might see a message that says
"go back".
I need the simplest briefest example - Thanks
Perhaps it would be user-friendlier to put the confirm() dialog in the
originating page? If user confirms, he goes to the new page. If user doesn't
confirm, he stays put:
<a href="yourPageHere.htm" onclick="return confirm('Are you sure?');">Go
somewhere</a>
Or you could have an "intermediate" page that shows the confirm() dialog and
forwards to the real page. The <body> might look something like this:
<script type="text/javascript">
if(confirm("Are you sure?")){
document.location.href = "yourPageHere.htm";
}
else if(document.referrer != ""){
document.write("<a href=\"" + document.referrer + "\">Back</a>");
}
</script>
document.referrer is supposed to be available when a page was reached by
clicking a link. (The text of the confirm() dialog buttons can't be changed
and may be a localized version of "OK" and "Cancel".)
--
Joakim Braun