Wow Web Designs Forums Home

Search
   
Members

Calendar

Help

Home
Search by username
Not logged in - Login | Register 
Wow Web Designs Forums > Scripting > HTML & CSS > Open New Page In Certain Size


Open New Page In Certain Size
 Moderated by: Aycan  

New Topic

Reply

Print
AuthorPost
Distortion
Member


Joined: Wed Feb 2nd, 2005
Location:  
Posts: 41
Status:  Offline
Mana: 
 Posted: Sun Feb 27th, 2005 01:54 am

Quote

Reply
ok well im gonna be re-doing my site again... and what i need is when people come to my site... im gonna have a enter picture and when they click it a new window opens but i want the window to be a certain size and there is no browser junk in the way. its just a small browser window holding the site with no search bars or anything... like this site http://www.docbrown.ca/

Please help me. Thanks

Note* this is probably really easy but it would be good if it was answered anyways for other people. I will look it up now but since your all computer wiz'z ill let you try :P

Last edited on Sun Feb 27th, 2005 02:51 am by Distortion

GenoBaby
Member


Joined: Fri Nov 1st, 2002
Location: Brooklyn, New York USA
Posts: 38
Status:  Offline
Mana: 
 Posted: Sun Feb 27th, 2005 07:44 pm

Quote

Reply
this is the syntax:

In the head section:
<script language="javascript">
function openWindow(){
window.open('URL','WINDOW NAME','ATTRIBUTE1, ATTRIBUTE2')
}
</script>

URL: the URL that is going to open.
WINDOW NAME: the distinct name you give a window.

ATTRIBUTES:
width=nn: the width of the window in pixels. nn represents a number.
height=nn: the height of the window in pixels. nn represents a number.
resizable=yes or no: disable or enable the user's ability to resize the window by dragging the window's edges.
scrollbars=yes or no: determine if the window will have scrollbars or not.
toolbars=yes or no: determines if the browser should have the navigation buttons (like Back, Forward, Refresh, Stop...).
location=yes or no: determines whether to show the address bar.
directories=yes or no: determines whether to show the extra buttons.
status=yes or no: determines whether to show the status bar on the bottom of the browser window.
menubar=yes or no: determines whether to show the menu buttons (Like File, Edit, View...).
copyhistory=yes or no: determines whether to carry old browser's history list.

so your link should look similar to this:

function openWindow(){
window.open('http://www.yahoo.com', 'newwin', 'width=500,height=500,resizable=no,scrollbars=no,toolbars=no,location=no,directories=no,status=no,menubar=no,copyhistory=no');
}

and then the link would look like this:

<a href="javascript:openWindow();">CLICK HERE</a>

relaxzoolander
Super Moderator


Joined: Sun Jan 25th, 2004
Location: Columbus, Ohio USA
Posts: 459
Status:  Offline
Mana: 
 Posted: Sun Feb 27th, 2005 11:12 pm

Quote

Reply
hi distortion!
opening sites in new windows is kinda annoying.
thats my opinion.
its bad for usability...bad for search engines...its old news.
embrace the imperfections of the web...and you will find the beauty.
dont do it man.

:)

r|z
-----------------------------------------------------------------
web design is beautiful

Distortion
Member


Joined: Wed Feb 2nd, 2005
Location:  
Posts: 41
Status:  Offline
Mana: 
 Posted: Sun Feb 27th, 2005 11:44 pm

Quote

Reply
well im wanting to try a new way... and my site is already all over the search engines...

thanks for the advice though... and thanks for helping me out there other guy... but r|z this is something i just wanna try out u know? have diffrent types of site in my skills.

relaxzoolander
Super Moderator


Joined: Sun Jan 25th, 2004
Location: Columbus, Ohio USA
Posts: 459
Status:  Offline
Mana: 
 Posted: Mon Feb 28th, 2005 07:02 am

Quote

Reply
thats cool.
have fun!

:P

r|z
--------------------------------------------------------------
graphic designer and company logo design

GenoBaby
Member


Joined: Fri Nov 1st, 2002
Location: Brooklyn, New York USA
Posts: 38
Status:  Offline
Mana: 
 Posted: Tue Mar 1st, 2005 10:09 pm

Quote

Reply
I almost forgot... i didn't look at the site example you sent... there's two more attributes that you can add so that you can positioned the new window at a desired location... like in the example you stated their pop up window is centered in the user's screen...

It's left & top

left: is the amount of pixels from the left of the screen and top is the amount of pixels from the top. So to have it centered you would make this your code:

function openWindow(){
window.open('[url=http://www.yahoo.com',/]http://www.yahoo.com',[/url] 'newwin', config='width=500, height=500, left='+(screen.width-500)/2+', top='+(screen.height-500)/2+', resizable=no, scrollbars=no, toolbars=no, location=no, directories=no, status=no, menubar=no, copyhistory=no');
}

I took the window's width and subtracted that from the width of the user's screen size and then divded that by 2 ... did the same with the height... and walaah... the open window will be centered.

Distortion
Member


Joined: Wed Feb 2nd, 2005
Location:  
Posts: 41
Status:  Offline
Mana: 
 Posted: Sat Mar 5th, 2005 07:31 pm

Quote

Reply
Thanks alot duder... But im having trouble making it open in the center of the screen. I din't quite understand those instructions... do you think you could run it by me again in a "centering new pages for dummies" :P

relaxzoolander
Super Moderator


Joined: Sun Jan 25th, 2004
Location: Columbus, Ohio USA
Posts: 459
Status:  Offline
Mana: 
 Posted: Sun Mar 6th, 2005 03:33 am

Quote

Reply
that script got a little messed up by the post editor.
try this...

add this to the head:
<script LANGUAGE="JavaScript">
function openWindowCentered(){
window.open('http://www.yahoo.com', 'newwin', 'width=500, height=300, left='+(screen.width-500)/2+', top='+(screen.height-300)/2+', resizable=no, scrollbars=no, toolbars=no, location=no, directories=no, status=no, menubar=no, copyhistory=no');
}
</script>



add this to the body:

<a HREF="#" ONCLICK="openWindowCentered();return false">This opens a new 500 x 300 window and centers it on screen.</a>


:dude:

r|z
-------------------------------------------------------------------------
moshbox web design of columbus ohio

ph00lnet
Member
 

Joined: Wed Mar 23rd, 2005
Location:  
Posts: 8
Status:  Offline
Mana: 
 Posted: Wed Mar 23rd, 2005 05:22 pm

Quote

Reply
I suppose if you're lazy you can use a generator: http://javascript.internet.com/generators/popup-window.html

 

 

relaxzoolander
Super Moderator


Joined: Sun Jan 25th, 2004
Location: Columbus, Ohio USA
Posts: 459
Status:  Offline
Mana: 
 Posted: Thu Mar 31st, 2005 10:51 pm

Quote

Reply
is distortion in the house?
...that ungrateful punk.

:P

r|z
------------------------------------------------------
residential architecture and architects house designs in columbus

Volt
Member
 

Joined: Sat Apr 2nd, 2005
Location:  
Posts: 1
Status:  Offline
Mana: 
 Posted: Sat Apr 2nd, 2005 09:24 pm

Quote

Reply
Thanks so much for that :) helped loads, i needed it for ma online radio, so it would open in a small new window. This worked brill, Thanks m8.:D

relaxzoolander
Super Moderator


Joined: Sun Jan 25th, 2004
Location: Columbus, Ohio USA
Posts: 459
Status:  Offline
Mana: 
 Posted: Fri Apr 8th, 2005 02:32 am

Quote

Reply
no problem.
glad to help.

r|z
--------------------------------------------------------------------------
columbus oh windows

wheels995
Member
 

Joined: Thu Apr 21st, 2005
Location:  
Posts: 3
Status:  Offline
Mana: 
 Posted: Thu Apr 21st, 2005 12:40 pm

Quote

Reply
Hey, I just joined up and saw this post. It has helped me alot. Is it possible to open more then 1 of these on one page? I have a site that I need to have multiple links on that each open a sizable window to show a product.

Any help is greatly appreciated. Thanks

GenoBaby
Member


Joined: Fri Nov 1st, 2002
Location: Brooklyn, New York USA
Posts: 38
Status:  Offline
Mana: 
 Posted: Thu Apr 21st, 2005 03:52 pm

Quote

Reply
I'm back... did you guys miss me. Let me get this straight... you want to different links to open windows at a specified size. Use the same code but use some parameters to help you out. Here's the syntax:

Put this in the HEAD section:

function openWindow(w, h, num){
 window.open('http://www.yahoo.com', num, 'width='+ w +', height=' + h + ', left='+(screen.width-w)/2+', top='+(screen.height-h)/2+', resizable=no, scrollbars=no, toolbars=no, location=no, directories=no, status=no, menubar=no, copyhistory=no');
}


And here is the hyperlink:

<a href="javascript:openWindow( 200, 500, 0 )">Open window at 200x500</a><br />
<a href="javascript:openWindow( 100, 400, 1 )">Open window at 100x400</a><br />
<a href="javascript:openWindow( 400, 400, 2 )">Open window at 400x400</a>


The first parameter sets the width, the second does the height and the last does the window's name. I added the windows name as a parameter so that a different window will open up when you click on the a different link. You can also pass the URL as a parameter. Look at the code and it's easy to figure out.

Hope this was helpful... If i was far off from the question elaborate and I'll answer again.

Last edited on Thu Apr 21st, 2005 04:02 pm by GenoBaby

wheels995
Member
 

Joined: Thu Apr 21st, 2005
Location:  
Posts: 3
Status:  Offline
Mana: 
 Posted: Fri Apr 22nd, 2005 03:26 pm

Quote

Reply
Thank you for the quick response. However what I need is as follows.

1 web page with 3 or more links on it.

link 1 opens http://www.yahoo.com
link 2 opens http://www.google.com
link 3 opens http://www.msn.com

all 3 of them open in a sizable window that can be moved or closed.

relaxzoolander
Super Moderator


Joined: Sun Jan 25th, 2004
Location: Columbus, Ohio USA
Posts: 459
Status:  Offline
Mana: 
 Posted: Sat Apr 23rd, 2005 10:09 am

Quote

Reply
wheels:

you have been given lots of guidance here.
i suggest you do some homework on your own rather than expect to be spoonfed javascript code.

here is the best place to learn javascript for beginners:
http://www.w3schools.com/js/default.asp

r|z
---------------------------------------------------------------------
columbus ohio windows

GenoBaby
Member


Joined: Fri Nov 1st, 2002
Location: Brooklyn, New York USA
Posts: 38
Status:  Offline
Mana: 
 Posted: Sat Apr 23rd, 2005 08:50 pm

Quote

Reply
If you look carefully at the code I posted you can figure out how to have different URLs... so pass another parameter inside of the function like this:

function openWindow(url, w, h, num)

and 'url' will be the URL that you set... it's really simple if you look at the code.

wheels995
Member
 

Joined: Thu Apr 21st, 2005
Location:  
Posts: 3
Status:  Offline
Mana: 
 Posted: Mon Apr 25th, 2005 01:26 pm

Quote

Reply
relaxzoolander:

I didn't think that a follow up question would be meet with a remark like yours. I am new to javascript and simply looking for help which GenoBaby gladly provided without anything in return except a thank you. I thought that was what this site was for. I don't expect anyone to spoon feed me anything. I am just looking for guidence. Speaking of which thank you for the link I have placed it in my bookmarks.

After looking through the posts I also noticed that you yourself had spoonfed someone else exact code to fix his problem witout any negitive coments or telling him to do it himself. Even though he had asked several time why something did not work.

I guess I'll have to find another site to get my questions answered as it appears that new people can not ask questions here.

relaxzoolander
Super Moderator


Joined: Sun Jan 25th, 2004
Location: Columbus, Ohio USA
Posts: 459
Status:  Offline
Mana: 
 Posted: Mon Apr 25th, 2005 11:49 pm

Quote

Reply
wah-wah!
i am mr. helpful.
...but spoonfeeding [and whining] is for kindergarteners.

here is another page for your bookmarks:
http://pbskids.org/

:P

r|z
----------------------------------------------------
columbus ohio web designer

Urobos
Member


Joined: Mon Mar 6th, 2006
Location: USA
Posts: 2
Status:  Offline
Mana: 
 Posted: Mon Mar 6th, 2006 04:31 am

Quote

Reply
This thread has helped me out in my efforts to make several individual Pop-Ups. But outside of setting size, URL, or other attributes is it possible to open a window that has bg color(s), text description, and a link to close the Pop-Up window?
Could/should these elements be defined in a attached CSS document?
Could/should they be defined in a separate .JS file?
If so, how do I attach a .JS file as I would a CSS file?
Any idears?
I'd rather not make 70+ windows as html files...
Thanks in advance,

Urobos


 Current time is 12:05 am
Page:    1  2  Next Page Last Page  




Powered by WowBB 1.7 - Copyright © 2003-2006 Aycan Gulez
Page processed in 0.2512 seconds (8% database + 92% PHP). 17 queries executed.