Results 1 to 12 of 12

Thread: Another center window question

Hybrid View

  1. #1
    Join Date
    Jul 2006

    Another center window question

    hello here's the chunk of code I need help with.

    <h3 align="center">Portrait, Beauty, Glamour and Fashion photography </h3>
    <p align="center"> <a href="#"><img src="jpg/fashionbeauty.jpg" width="513" height="132" hspace="" vspace="" border="0" onclick="MM_openBrWindow('portfoliowindow.html','fashionbeauty','scrollbars=yes,width=600,height=600 , top=-50%, left=50')"/></a></p>

    I wish to have the window that is opened, open in the exact center of the screen, from left, and top.

    Can someone provide the right help, and where to put it.

    As you can see I have been trying the wrong methods.


    top=-50%, left=50')"/>

    -50% is not working.

    Thank you


  2. #2
    Join Date
    Mar 2005
    Sydney, Australia
    See http://www.felgall.com/cshow03.htm for how to put something in the exact centre of the window.

  3. #3
    Join Date
    Jul 2006
    Guy... none of your answers anywhere on this site ever help. Someone always comes along and one ups you. All the time. It's because you don't read the postings before you type...

    Obviously you did not read my posting... I do not need to know how to center a table... i'm not using tables... I have pasted the code I wish to amend above... fix that your the man, post another meaningless reply, well... it is what it is.


  4. #4
    Join Date
    Apr 2006
    Give this a try. I'm not sure it will work from inside the script but it is how an object is centered using css.
    onclick="MM_openBrWindow('portfoliowindow.html','fashionbeauty','scrollbars=yes','width=600','height =600' , 'top=50%', 'left=50%', 'margin_top=-300px', 'margin-left=-300px',position=absolute')"/></a></p>
    I'm not sure if the px on the end is needed, so try it with it and without it.

  5. #5
    Join Date
    Apr 2006
    Ok time up for editing so I'll just repost
    onclick="MM_openBrWindow('portfoliowindow.html','fashionbeauty','scrollbars=yes','width=600','height =600' ,'top=-50%','left=50%','margin-left=-300','margin-top=-300','position=absolute')"/></a></p>

    Make sure you always have an apostrophe in front and end of the style element

  6. #6
    Join Date
    Jul 2006
    Hi WebJoel...

    Tissues are available at modest prices in your local supermarkets, drugstores and kwiki marts....

    I'm glad Felgall has helped you out. That's terrific. I am not (obviously) replying to just this one post from him. He has generously replied to many of my posts in the past with lots of information and not very much substance. It's nice that we have access to a forum where we can all share our ideas, concepts and maybe even our dreams. I have no ill against the fellow, just wish he would read the post, before... the reply!

    Your either the ass*ole here or the newbie, i'll be the ass*ole newbie I guess and make it real easy for you, I'm here to solve my design problems not setup internet lunch dates, and I highly doubt anyone else is.... I know that someone out there (the forum users) can fix my problem in about 2 seconds... there are far more brilliant than I designers and I keep my questions short so I don't waste their time...

    So, these brilliant minds are 'up to my standards' and with great respect to them I say thank you for helping out. The ones who can't read BEFORE the reply, well, I guess they can't read...

    Well this is too long, WebJoel thanks for your insight into my ego.


  7. #7
    Join Date
    Jul 2006
    sticks, thank you.

    I've tried with both no px at the end at with px at the end. It now opens the new window full screen and ignores the controls (width / height).

    I am using:

    Safari 3

    if this means anything. Thank you.


  8. #8
    Join Date
    Mar 2005
    Sydney, Australia
    Sorry, misread the requirements with my earlier reply but it looked like you wanted it in the current page rather than as a new window.

    To open a window in the exact center of the screen you need to know the screen width and height and then subtract the width and height of the window to be opened and then divide by 2.

    So if you want the window to have a width and height of 600 then you want

    onclick="var w = (screen.width - 600) / 2;var h = (screen.height - 600) / 2;if (w < 0) w = 0;if (h < 0) h = 0;window.open('portfoliowindow.html','fashionbeauty','scrollbars=yes,width=600,height =600, top='+h+'px, left='+w+'px')"
    Last edited by felgall; 07-03-2007 at 09:00 PM.

  9. #9
    Join Date
    Jun 2007

    Lightbulb Great Work

    Now let's drop it in a function and never have to code it again.

    <script language="javascript">
    function winOpen(pagename,name,left,top,width,height,scroll,resize) {
    var w = (screen.width - width) / 2;
    var h = (screen.height - height) / 2;
    if (w < 0) w = 0;
    if (h < 0) h = 0;

    window.open(''+pagename,name,'left='+left+',top='+top+',width='+width+',height='+height+',toolbar=1, location=0,scrollbars=0,resizable=0');


    <h3>Javascript Window Demo</h3><br>
    <input type="button" value="open window" onclick="javascript:winOpen('pagetwo.html','myWindow',100,100,300,300,1,0);">

  10. #10
    Join Date
    Jul 2006
    Thank you kindly gentlemen, I will try this out tomorrow. Much appreciated.


  11. #11
    Join Date
    Jul 2006
    Felgal, your the f*&^ing man!

    Brilliant. works flawlessly. Much appreciated.



  12. #12
    Join Date
    Dec 2005
    American, living in Toronto, ON. CANADA
    Guy... none of your answers anywhere ....
    Ouch! -I'm not even going to touch that one. Respect to felgall, -his posts have helped me innumerable times withmy coding projects (even if it wasn't a reply to a question I asked, I have incorporated his advice). We are very fortunate to have felgall come here. Suggestion: contact a mod. and request that the offending post be deleted. Then perhaps, someone else whom is 'up to your standards' can solve your problem for you.
    Last edited by WebJoel; 07-03-2007 at 08:45 AM.
    I build for: Firefox and tweak for IE

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center



X vBulletin 4.2.2 Debug Information

  • Page Generation 0.15578 seconds
  • Memory Usage 3,279KB
  • Queries Executed 13 (?)
More Information
Template Usage (30):
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (12)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (12)postbit
  • (12)postbit_onlinestatus
  • (12)postbit_wrapper
  • (1)showthread_list
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (27):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./includes/functions_threadedmode.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (71):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids_threaded
  • showthread_threaded_construct_link
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates