Script Categories













Page Details >>> Smart Popup.

Create popup windows that will center on your screen or popup near your link without popping off the edge of the screen. Also shows how to create a clickable popup or a popup that displays when you hover over the link with your mouse.

Test Width: Test Height:
Test POPCLICK
Test POPCLICKCENTER
Test POPUP
Test POPUPCENTER

Add the below code to the <body> section of your page:

<script language="javascript" type="text/javascript">      
/* Visit http://www.yaldex.com/ for full source code
and get more free JavaScript, CSS and DHTML scripts! */
<!-- Begin
var version4 = (navigator.appVersion.charAt(0) == "4");
var popupHandle;
function closePopup() {
if(popupHandle != null && !popupHandle.closed) popupHandle.close();
}
function displayPopup(position,url,name,height,width,evnt) {
// position=1 POPUP: makes screen display up and/or left, down and/or right
// depending on where cursor falls and size of window to open
// position=2 CENTER: makes screen fall in center
var properties = "toolbar = 0, location = 0, height = " + height;
properties = properties + ", width=" + width;
var leftprop, topprop, screenX, screenY, cursorX, cursorY, padAmt;
if(navigator.appName == "Microsoft Internet Explorer") {
screenY = document.body.offsetHeight;
screenX = window.screen.availWidth;
}
else {
screenY = window.outerHeight
screenX
= window.outerWidth
}
if(position == 1) { // if POPUP not CENTER
cursorX = evnt.screenX;
cursorY = evnt.screenY;
padAmtX = 10;
padAmtY = 10;
if((cursorY + height + padAmtY) > screenY) {
// make sizes a negative number to move left/up
padAmtY = (-30) + (height * -1);
// if up or to left, make 30 as padding amount
}
if((cursorX + width + padAmtX) > screenX) {
padAmtX = (-30) + (width * -1);
// if up or to left, make 30 as padding amount
}
if(navigator.appName == "Microsoft Internet Explorer") {
leftprop = cursorX + padAmtX;
topprop = cursorY + padAmtY;
}
else {
leftprop = (cursorX - pageXOffset + padAmtX);
topprop = (cursorY - pageYOffset + padAmtY);
   }
}
else{
leftvar = (screenX - width) / 2;
rightvar = (screenY - height) / 2;
if(navigator.appName == "Microsoft Internet Explorer") {
leftprop = leftvar;
topprop = rightvar;
}
else {
leftprop = (leftvar - pageXOffset);
topprop = (rightvar - pageYOffset);
   }
}
if(evnt != null) {
properties = properties + ", left = " + leftprop;
properties = properties + ", top = " + topprop;
}
closePopup();
popupHandle = open(url,name,properties);
popupHandle.focus();
}
//  End -->
</script>
<form name="formtest">
Test Width: <input maxlength=3 size=3 type=text value="220" name="testwidth">
Test Height: <input maxlength=3 size=3 type=text value="120" name="testheight">
<br><a href="javascript:void(0)" onmouseover="window.status='Click for more information'; return true" onClick="displayPopup(1,'http://yaldex.com/JSFactory_Pro.htm','popup3',document.formtest.testheight.value,document.formtest.testwidth.value,(version4 ? event : null));">Test POPCLICK</a>
<br><a href="javascript:void(0)" onmouseover="window.status='Click for more information'; return true" onClick="displayPopup(2,'http://yaldex.com/JSFactory_Pro.htm','popup3',document.formtest.testheight.value,document.formtest.testwidth.value,(version4 ? event : null));">Test POPCLICKCENTER</a>
<br><a href="javascript:void(0)" onMouseOver="displayPopup(1,'http://yaldex.com/JSFactory_Pro.htm','popup1',document.formtest.testheight.value,document.formtest.testwidth.value,(version4 ? event : null))" onMouseOut="closePopup()">Test POPUP</a>
<br><a href="javascript:void(0)" onMouseOver="displayPopup(2,'http://yaldex.com/JSFactory_Pro.htm','popup2',document.formtest.testheight.value,document.formtest.testwidth.value,(version4 ? event : null))" onMouseOut="closePopup()">Test POPUPCENTER</a>
</form>

JavaScript Editor Get Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.



Code was highlighted by 1st JavaScript Editor (The Best JavaScript Editor!).

online casino in Canada


©