Thread: Popup Window
Results 1 to 3 of 3
Related
-
Popup-like window Forum: HTML Forum
Replies: 0 -
Problem with popup window Forum: Javascript Forum
Replies: 0 -
positioning a popup window Forum: HTML Forum
Replies: 1 -
popup window Forum: HTML Forum
Replies: 1 -
Popup window to fit? Forum: HTML Forum
Replies: 1
-
06-18-2001, 11:35 AM #1
Popup Window
Hi
How can I get a popup window to open in the top left hand corner of a web page, and make sure the window opens just enough for the user to see two lines of text.
Thanx
Sean
-
06-19-2001, 01:07 AM #2
Heres some code, I have not used positioning as I am pretty sure that the default is to popup in the top left of the page -
This goes pretty much anywhere, but I put it in the head -
function popUp() {
var win = window.open("targetpage.html", null, "height=20 width=150 resizable=yes");
}
And then you call it by -
<a href="javascriptopUp()">Pop me up!</a>
Instead of using a target page, you can also have the function write the new popup page itself. Here is one I use which makes a popup mail form -
function mail() {
var win = window.open("", null, "height=250 width=300 resizable=yes");
win.document.write("<body bgcolor=' #6666ff'><h1>Apply for Newsletter</h1><form action='mail.php' method='post'><input type='text' name='email'> Your email<br><input type='submit' value='Join mailing List'></form><form><input type='button' value='close' onClick='self.close()'></form></body>");
}
Only thing to watch using document.write, is that you have to have it all on the same line, i.e. no carriage returns. Unless, that is, you concatenate the different lines. Also, use ' instead of ", or else it thinks that the instruction is over.
Does that make sense? Post if not.
Laters,
------------------
QuietDean-
-
06-19-2001, 01:09 AM #3
Grrr
that should be a : next to a p, not :P
Also, don't forget to surround your functions with -
<script language="JavaScript">
<!--
{script}
//-->
</script>