469,631 Members | 1,776 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,631 developers. It's quick & easy.

load a popup window on login

How can I make a popup window that opens everytime a user logs in?

I'm using javascript with php
Dec 7 '07 #1
3 3344
Ferris
101 100+
How can I make a popup window that opens everytime a user logs in?
you can use window.open(fileName); to open a new window, but the popup window will be usually blocked by browser.

you can also create an div element in page, when the user logs in, show this element. it will never be blocked,but it is not a real popup window.

I wrote the sample code for you , hope it helps.

[HTML]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>User log in Page</title>
</head>
<style type="text/css">
<!--
body{
background-color:#E4DFFF;
}
-->
</style>
<body>
user log in successfully
<br />
<div id="popupWindow" style="position:absolute; left:178px; top:64px; width:426px; height:280px; border:1px solid; background-color:#FFFFFF">
<div style="text-align:right; background-color:#CED3FF"><a onclick="document.getElementById('popupWindow').st yle.display = 'none';" style="cursor:pointer;">Close</a></div>
<div>This is your popup window<br />You can click "Close" to close it.</div>
</div>
</body>
</html>
[/HTML]
Dec 7 '07 #2
you can use window.open(fileName); to open a new window, but the popup window will be usually blocked by browser.

you can also create an div element in page, when the user logs in, show this element. it will never be blocked,but it is not a real popup window.

I wrote the sample code for you , hope it helps.

[HTML]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>User log in Page</title>
</head>
<style type="text/css">
<!--
body{
background-color:#E4DFFF;
}
-->
</style>
<body>
user log in successfully
<br />
<div id="popupWindow" style="position:absolute; left:178px; top:64px; width:426px; height:280px; border:1px solid; background-color:#FFFFFF">
<div style="text-align:right; background-color:#CED3FF"><a onclick="document.getElementById('popupWindow').st yle.display = 'none';" style="cursor:pointer;">Close</a></div>
<div>This is your popup window<br />You can click "Close" to close it.</div>
</div>
</body>
</html>
[/HTML]

Could I also use it to display php code. because I need to use it for a php program that I'm doing.
Dec 8 '07 #3
Ferris
101 100+
Could I also use it to display php code. because I need to use it for a php program that I'm doing.
I don't know much about php,but I think you can use echo to write HTML code into a php page.

[PHP]
<?php
echo "<div style=\"text-align:right;background-color:#CED3FF\"><a
onclick=\"document.getElementById('popupWindow').s tyle.display= 'none';\" style=\"cursor:pointer;\">Close</a></div>";
?>
[/PHP]


replace "displ ay" into "display"
Dec 8 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

26 posts views Thread by Raffi | last post: by
2 posts views Thread by Brian Henry | last post: by
1 post views Thread by Kalyani | last post: by
1 post views Thread by gvrajkumar | last post: by
4 posts views Thread by goscottie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.