PDA

View Full Version : PHP Alert script


marvc
09-22-2002, 06:14 AM
Anyone know if it's possible to generate an advisory alert window using php, if so, can they post the code? I've been searching and have come up with one using Java, but was wondering if this was possible with php?
I have a poetry section on my site that will contain a section which will display adult type content. I'd like for viewers that choose to view the content in this section to be greeted with an alert window at the beginning and end of each page that's viewed provding them with an option to continue or exit to the default page.
In other words:
1. The user clicks the link to view the content and gets an alert advising on the nature of content and asked to continue or exit to the default page.
2. Before the page finish loading; the user gets another alert asking the same question.

I'd like to have it happen 3 times, that way the user has a full understanding of what they're about to get in to. I'm not sure if it matters if you use java or php, but I figure I'd ask and see.
Any help on this is appreciated.

firepages
09-22-2002, 09:47 AM
Hi, this is really a javascript issue ... though you can use PHP to generate the javascript like so...

<?echo "<script>alert('some_message');</script>";?>

but I assume you will need a javascript 'confirm' box so moving you to javascript section ...

boywonder
09-22-2002, 03:13 PM
this will warn somebody three times before loading a new page.

<script language="JavaScript" type="text/javascript">
<!--
function conf(){
if(!confirm("are you sure?")) return false;
if(!confirm("are you REALLY sure?")) return false;
if(!confirm("are you POSITIVE?")) return false;
return true;
}
//-->
</script>

use an onclick statement like below in any link that you want to warn about:

<a href="somepage.htm" onclick="return conf();">click</a>