-
Popup Window Help Please
OK I have this code for a popup window that I found...
<script language="JavaScript">
<!--
var w = 480, h = 340;
if (document.all) {
/* the following is only available after onLoad */
w = document.body.clientWidth;
h = document.body.clientHeight;
}
else if (document.layers) {
w = window.innerWidth;
h = window.innerHeight;
}
var popW = 300, popH = 200;
var leftPos = (w-popW)/2, topPos = (h-popH)/2;
window.open('tcw.htm','popup','width=' + popW + ',height='+popH+',top='+topPos+','left='+leftPos);
//--></script>
Now I put that in the head section I think right?
My question is, how do I actually popup the window? IM confused on that part. Lets say I have a page called a.html with a link on it called "CLICK HERE" once you click that link, it will open up the popupwindow. Do I need more code in the body?
-
Wrap all that code in a function here it's called myFunction
then
Code:
<a href="javascript:myFunction();">click me</a>