Forum Moderators: phranque

Message Too Old, No Replies

Where can I learn to make popups?

Need links of popup tutorials

         

webustaad

7:06 pm on May 22, 2003 (gmt 0)

10+ Year Member



Dear webmasters!

I hope u all are fine and in good health.

Can you give me links of any popup tutorials.

oilman

7:13 pm on May 22, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



very nearly two years ago here at WebmasterWorld some folks were hacking away to come up with the best and simplest js popup script around. Here's what they came up with:

1) For the .js file or the HEAD section

function cPop(url, wide, high) {window.open(url,"popup",'width=' + wide + ',height=' + high);
}

2) Link code for the body:

<a href="javascript:cPop('pagename.html',www,hhh)">Link</a>

webustaad

9:14 pm on May 22, 2003 (gmt 0)

10+ Year Member



Thanks a lot for the script. Is 1 and 2 both part of the script? Can I use this in Frontpage?

jatar_k

9:18 pm on May 22, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



the 2 parts go where oilman specified
1) For the .js file or the HEAD section (the actual script)
2) HTML Link code for the body section (the link that calls the function)

You will have to paste them into the actual source, how you do that in frontpage I am not sure but they must have some kind of source view mode.

dmorison

9:21 pm on May 22, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi webustaad,

There are tons of pop-up and pop-under scripts on the net - Google will reveal plenty of free scripts.

Try

[google.com...]

and

[google.com...]

oilman -

Are you serious? It took a hacking competition to come up with window.open()?

jatar_k

9:23 pm on May 22, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



maybe this was the point
come up with the best and simplest js popup script

that was eons ago in our world. ;)

mossimo

2:30 am on May 23, 2003 (gmt 0)

10+ Year Member



Here's a pop-up with all the features including centering the pop-up window. If you know of a cleaner way of doing this let me know

--------JavaScript Part--------

function MM_openBrWindow(theURL,winName,features) { //v2.0
new_width = features.substring(features.indexOf("width=")+6,features.indexOf("width=")+9) * 1
new_height = features.substring(features.indexOf("height=")+7,features.indexOf("height=")+10) * 1
var left = Math.floor( (screen.width - new_width) / 2);
var top = Math.floor( (screen.height - new_height) / 2)
var winParms = "top=" + top + ",left=" + left
if (features) { winParms += "," + features; }
window.open(theURL, winName, winParms);
}

--------Link Part--------

<A href="javascript:;" onclick="MM_openBrWindow('http://www.#.com','winname','toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=555,height=555')">link_name</a>

keyplyr

8:42 am on May 23, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



If you want a leaner script without all the extra stuff:

var win= null;
function NewWindow(mypage,myname,w,h,scroll){
var winl = (screen.width-w)/2;
var wint = (screen.height-h)/2;
settings='height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',toolbar=no,location=no,status=no,menubar=no,resizable=no,dependent=no'
win=window.open(mypage,myname,settings)
if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}

And a simpler link:

<a href="javascript:NewWindow('page_name.html','popup','400','300','no')">Link_Name</a>

Adjust width and height as desired.

Note: This linking method will prohibit robots from finding the pop-up,
which is the way I like it. However, if you wish the pop-up crawled, do
a site-search for Tedster's vanillia link.

oilman

4:13 pm on May 23, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



>>Are you serious? It took a hacking competition to come up with window.open()?
hehe - nah - it's like jatar_k said - we just kept trimming away until we came up with the smallest workable js we could. Long time ago now :)