Log inUsernamePassword
Log me on automatically each visit    
Register
Register
Log in to check your private messages
Log in to check your private messages
CJ Webmaster Forums Forum Index » Other Languages

Post new topic   Reply to topic
Pop-up window
View previous topic :: View next topic  

Is this script usefull?
Yes
 100%  [ 5 ]
No
 0%  [ 0 ]
Dunno.. To lazy to try
 0%  [ 0 ]
Total Votes : 5

Author Message
mozkov



Joined: 06 Oct 2003
Posts: 26

PostPosted: Fri Jan 23, 2004 2:03 pm    Post subject: Pop-up window Reply with quote

OK, for the people that don't know how to open a pop-up window, here's how to do it. With javascript! Exclamation

First of all, put this piece of code into your header (that is, between the <head> and </head> syntags) :

Code:

<script language="javascript">
<!--
var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbar=no, resizable=no, copyhistory=yes, width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}
// -->
</script>


The only thing you might want to edit is this (the stuff in red) :

toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbar=no, resizable=no, copyhistory=yes

Only change 'yes' to 'no' or 'no' to 'yes' if you wanna.

Then, after you changed the code (not neccesary), and pasted it into your header, (or in a remote JS file, whatever you wish), you can open the window on some different ways.

1) when the page loads:

enter the following piece of code into your <body>-syntag:
Code:
onLoad="popUpWindow('theUrlHere', 'howManyPixFromLeftHere', 'howManyPixFromTophere', 'popupWindowWidthHere', 'popupWindowHeightHere');"


2) when you leave the page:

enter the following piece of code into your <body>-syntag:
Code:
onUnload="popUpWindow('theUrlHere', 'howManyPixFromLeftHere', 'howManyPixFromTophere', 'popupWindowWidthHere', 'popupWindowHeightHere');"


3) With a link:

There are 2 ways to do that.

The first is:
Code:
<a href="javascript:popUpWindow('theUrlHere', 'howManyPixFromLeftHere', 'howManyPixFromTophere', 'popupWindowWidthHere', 'popupWindowHeightHere');">Linktext here</a>


..And the second:
Code:
<a href="#" onClick="javascript:popUpWindow('theUrlHere', 'howManyPixFromLeftHere', 'howManyPixFromTophere', 'popupWindowWidthHere', 'popupWindowHeightHere');">Linktext here</a>


4) with a button:

Code:
<button onClick="javascript:popUpWindow('theUrlHere', 'howManyPixFromLeftHere', 'howManyPixFromTophere', 'popupWindowWidthHere', 'popupWindowHeightHere');">Buttontext here</button>





There.. hope it's usefull! Mr. Green
Back to top
View user's profile Send private message
zeroday



Joined: 03 Aug 2005
Posts: 1

PostPosted: Wed Aug 03, 2005 6:25 pm    Post subject: Reply with quote

I didn't realize there were so many attributes for the pop up window object. Do you know of a javascript API kicking around anywhere?
_________________
Cheap web hosting packages
Back to top
View user's profile Send private message
darkcarnival
CJ-Design.com Admin



Joined: 10 Jul 2003
Posts: 1290
Location: Michigan

PostPosted: Thu Aug 04, 2005 4:21 pm    Post subject: Reply with quote

i do Smile

my good friend andy has a site that has a pop-up generator

http://www.webdevtips.com/webdevtips/codegen/openwin.shtml

he also has several other neat things to look at as well Smile
_________________
List of Mods to James Scripts!
http://www.cj-design.com/forum/viewtopic.php?t=1798

Elite Bulletin Board v0.5 help test it for me:
http://www.elite-board.z42.us/
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    CJ Webmaster Forums Forum Index » Other Languages All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2001, 2002 phpBB Group
iCGstation v1.0 Template By Ray © 2003, 2004 iOptional, Mods by CJ Website Design