CodeToad Forums » Java » how to open instantly a pop up window whenever a user sends a message to the other user
|
|
|
Hi! I'm a junior student at De La Salle University-Manila, and we, our group is having a chat project. We're just new to Java. We decided to place our chat in a jsp page, since we're not using applet, and we still don't know how to use it. The problem is, we don't know how we can notify a user, by opening a pop-up window whenever someone sends a message to him. For example, if I click the username of the person I want to chat with, that person will automatically get a pop-up window (in our case we named our chat window privateChat) displaying the message sent to him. And also, does anyone know how we can display a notification that this particular user has already logged and how he cannot view the pages he has logged out from when he presses the back button? Please, I would very much appreciate any help you can give our group. We're just in a hurry because we have to finish this by next week. Thank you so much in advance!
Carol =)
|
|
|
You can open popup window through javascript. But opening it at center of the screen will make it look good for all size of screen.
Following is the way to do it :
This is the link to open popup window
<a href="javascript:void(0);" onclick="popup('http://www.google.com',
'googlePopup',700,600);">OPEN GOOGLE</a>
and the javascript function is
function popup(pageURL, title, popupWidth, popupHeight)
{
var left = (screen.width / 2) - (popupWidth / 2);
var top = (screen.height / 2) - (popupHeight / 2);
var targetPop = window.open(pageURL, title, 'toolbar=no, location=no, directories=no,
status=no, menubar=no, scrollbars=YES, resizable=YES, copyhistory=no, width=' + popupWidth + ',
height=' + popupHeight + ', top=' + top + ', left=' + left);
}
thanks
Eliza http://www.mindfiresolutions.com/
|
|
|
|
|
|
|
|