logo-dw

Go Back   Dreamweaver Club Forums > Dreamweaver forums > Dreamweaver General
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 01-31-2006, 04:38 AM   #1
chriskq
chriskq's Avatar
 
Join Date: Oct 2005
Location: Sydney - DownUnder
Posts: 798
Default Anyone say "popup"

Hey all im quite proud of writing my first java script.
dreamweaver could not preform what i wanted, so build from raw code.

thought i'd post it here as i remember ppl asking about this some time ago

the script
Code:
		function newWindow(myUrl,w,h,features) {
			var settings = "";
			if (screen.width) {
				var winl = (screen.width-w)/2;
				var wint = (screen.height-h)/2;
			} else {
		  		winl = 0;
				wint = 0;
			}
			if (winl < 0) winl = 0;
		 	if (wint < 0) wint = 0;
			settings = 'height=' + h + ',';
			settings += 'width=' + w + ',';
			settings += 'top=' + wint + ',';
			settings += 'left=' + winl;
			if (features != "") settings += ',' + features;
			myWin = window.open(myUrl,"myWin",settings);
			myWin.window.focus();
			return myWin;
		}
		
		function init() {
			var myWin = newWindow("YOUR_PAGE_NAME.html", 300, 250, "resizable=no,scrollbars=no,toolbar=no,menubar=no,location=no,statusbar=no");
		}
then in the site where you want the pop up to appear add
Code:
<body onload="init();">
i made this pop up to come in the center of the screen with options such as no toolbar, non-resizable, no location, no status bar and no scrollbar.

then in the pop-up html page call the js
Code:
<script src="common/scripts/popup.js" type="text/javascript"></script>
you can have whatever u like in the pop-up window, a flash object, images or some sort of monthly promotional thing

i know pop-ups can be very annoying, but can also be a more direct way of getting ppl's attention (by shoving it in their face, your bound to get a reaction--- yes i kno maybe negative aswel)

could make it into a mini tut C.I. anyways ppl - EnjoyA!
chriskq is offline   Reply With Quote
Old 01-31-2006, 12:37 PM   #2
domedia
Administrator
domedia's Avatar
 
Join Date: Dec 2003
Posts: 9,730
Default

I wrote a quick, accessible way of doing the same thing some months ago:
http://www.domedia.org/oveklykken/javascript-pop-up.php
domedia is offline   Reply With Quote
Old 01-31-2006, 10:31 PM   #3
chriskq
chriskq's Avatar
 
Join Date: Oct 2005
Location: Sydney - DownUnder
Posts: 798
Default

oh dont i suck. my bad
chriskq is offline   Reply With Quote
Old 02-01-2006, 09:07 AM   #4
kate
 
Join Date: Apr 2005
Posts: 458
Default

Nice lorry....
kate is offline   Reply With Quote
Old 02-01-2006, 12:52 PM   #5
domedia
Administrator
domedia's Avatar
 
Join Date: Dec 2003
Posts: 9,730
Default

Quote:
Originally Posted by chriskq
oh dont i suck. my bad
lol . why?
domedia is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:27 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com