Jump to content

Replying to an alert ..sort of


lxndr

Recommended Posts

I'm not sure if this is the best place to ask this question as it all depends on what the answer is.  Basically, I need to modify an existing php program with reads in a file of messages and if there's a message for the user who's running the program it generates a javascript alert with the message displayed in it.

 

What I need to be able to do is provide the means of replying to the alert.  I could do away with the alert altogether of course but I need something that sits on top of the screen in all browsers that can only be got rid off by clicking OK (or by replying).

 

I'm simply not sure of the best way to go about this and would welcome any positive suggestions or help.

 

TIA..

 

Link to comment
Share on other sites

What about a javascript popup window instead of a alert. You could use focus() to bring it to the front so they see it?

 

Then you can have whatever page inside the popup with options for the user to click.

 

 

Do you know if that will that work cross-browser consistently including Opera and Safari ?

 

__

 

Link to comment
Share on other sites

No, javascript can be disabled by the user and therefor isn't consistant in any browser. Use something like PHP and make a little class or function to display it at the top of the page each time it loads, then when they do whatever update the status. 

Link to comment
Share on other sites

 

php example quick one.

<?php

// display message if field is empty

if (empty($username)) {

$error="Please enter a username.<br><br>

<a href='whatever.com/start_agin.php'>Try agin</s>";

echo $error;
exit;
}

if (empty($password)) {
    $error= "Please enter a password.<br><br>

<a href='whatever.com/start_agin.php'>Try agin</s>";
echo $error;
    exit;
} 

if (empty($email)) {
    $error= "Please enter a valid email<br><br>

<a href='whatever.com/start_agin.php'>Try agin</s>";
echo $error;
    exit;
} 



?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.