Link to home
Start Free TrialLog in
Avatar of rbbb
rbbb

asked on

alert messages similars to messenger service

I would like to emulate the windows messenger services popups. This is: A javascript alert message with user IP adress, date and hour. I think is necessary first to detect the user info
with PHP or ASP for example, and then display the alert message.
Avatar of adktd
adktd
Flag of United States of America image

Hi rbbb
Tell me more of what you want to do.What you are saying is very general.You have to be more specific
Avatar of rbbb
rbbb

ASKER

OK, I need to display randomly this kind of javascript alert messages:

function alertPopup1() {
alert("Message from HAPPY HOLYDAYS to 80.25.84.74 - 16/10/2003 10:15:36\n\nHello!\n\nThere is an incredible holydays offer on our page:     \n\nhttp://www.happyholydays.com/\n\nEnjoy the life!");
}

I also would like to display the messages with
a random delay of 2-30 min.

Thanks a lot for your help.
ASKER CERTIFIED SOLUTION
Avatar of adktd
adktd
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rbbb

ASKER

All right !! thank you so much. Only a question more about this script.
How can I display the user IP, date and hour in the text of these random alert messages?

Once more, thanks.
Ok here's how u'll do it.

-----for displaying the ip of the visitor :

<script language="javascript">
var ip = '<!--#echo var="REMOTE_ADDR"-->'

function ipval() {
document.myform.ipaddr.value=ip;
}
window.onload=ipval
</script>

<form method="post" action="" name="myform">
  <input type="text" name="ipaddr" readonly>
</form>

in order to get this function to work your web srver must run ssi(most web servers do that by default)

---for displaying the date :

<script language="JavaScript">
HoldDate=new Date();
document.write(HoldDate.getDate() + "/" + (HoldDate.getMonth()+1) + "/" + HoldDate.getYear());
</script>

---for displaying the time :
<script type="text/javascript">
var d = new Date()
document.write(d.getHours())
document.write(":")
document.write(d.getMinutes())
document.write(":")
document.write(d.getSeconds())
</script>

I'm giving you the general code of the scripts,u r the one that should put all these together.