Put this into the <head> of your html:
[tt]
</script>
function popupPage(url,w,h) {
var windowprops = "location=no,scrollbars=no,menubar=no,toolbar=no,resizable=no" + ",left=100,top=100" + ",width=" + w + ",height=" + h + ";"; // change the top and left values to adjust window position
a = window.open(url,"popup",windowprops);
a.document.open();
a.document.write("<html><body><h3>Message Header</h3><p>Message text goes here.</p></body>"//here is the message that will be displayed
a.document.close();
}
</script>
[/tt]
If you want to open a popup when you click the link, do this:
[tt]
<a href="#" onclick="popupPage('',200,300); return false;">open new win</a>
[/tt]
If you want it to appear when you click a button, do this:
[tt]
<input type="button" value="open new win" onclick="popupPage('',200,300)">
[/tt]
If you want it to load autamatically when page finish loading, do this:
[tt]
<body onload="popupPage('',200,300)">
[/tt]
You can adjust the window winth/height by changing the values in function call:
popupPage('',W,H)
And, finally, it's a good idea to search HTML and JS forums/FAQs first, because there questions are discussed very ofter.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.