Results 1 to 6 of 6

Thread: Keep pop-up window on top

  1. #1
    Join Date
    May 2008

    Keep pop-up window on top

    Hi... I asked a question yesterday, but I suspect I had not explained what I wanted to do in a short javascript. So I'm hoping to make it clear with a very short listing of what I want. This is a very short part of the program for a clearer idea --

    <title>Open New Window</title>
    <script language="JavaScript1.2">
    function newWindow (newUrl)
    window.open (newUrl,"mywindow","location=1,status=1,scrollbars=1,width=650,height=650");

    <img src=owl.jpg height=30 width=30 hspace=20 onMouseDown=newWindow('owl.html')><br>
    Penguin ==>><br>
    <img src=penguin.jpg height=30 width=30 hspace=20 onMouseDown=newWindow('penguin.html')><br>

    When the user goes onMouseDown on the thumbnail in the main page, it brings up a popup window of the same name as the jpg but with a much larger amount of data. I have everything worked out except that when going onMouseDown anywhere but manually closing the popup window by using the "X" close, the popup window goes BEHIND the main frame, and thus in the much larger program I have the user now cannot see that the popup window has not closed, and when going onMouseDown on another thumbnail the user does not see that the new popup replaced the old popup window, but he cannot see it, because it is now behind the main window. I'd like to know how to keep the popup window on top of the main window in all cases! So that it never goes behind the main window no matter what new onMouseDown action is taken, other than to manually close the popup window.

    <fx: prays that this convoluted explanation is clear to someone far far better than I am>

  2. #2
    Join Date
    Feb 2008
    Hi BigBaron
    Have you considered using popup style div elements instead of new windows, they give a similar effect with much more control.
    Take a look at http://www.astral-consultancy.co.uk/...doco.cgi?11540
    Hope this helps

  3. #3
    Join Date
    May 2008
    Thanks a lot!!! That appears to be exactly what I need. It will take some work to change all the html but it does keep the popup on top, which is what I wanted. Again... thanks..

  4. #4
    Join Date
    May 2008

    Keep pop-up window on top

    Oops... I spoke too soon. Using the methods in that link I did find that it keeps the pop-up on top, but always at the same absolute relative uppermost position in respect to the main page. The main html page in my whole program is quite long, so when the thumbnail is located more than the length of the part of the entire main page which is in view, by having scrolled down that far, clicking on the thumbnail does keep the pop-up on top but it can't be seen without going back to the TOP of the main page. I'm almost there but I need something that will bring up the popup relative to where the thumbnail is located on the main page, rather than the uppermost part of the entire main page. The div function does keep the popup on top... but also on the absolute upper edge of the main page as well. So far on the upper edge that no one can see it, if clicking on a thumbnail that has been found by scrolling down the main page far enough that the uppermost part of the main page is no longer in view.

  5. #5
    Join Date
    Feb 2008
    Try setting the DIV position before it is displayed by getting the values from scrollTop, scrollLeft, clientHeight and clientWidth document properties.

  6. #6
    Join Date
    May 2008
    Again, thanks. I now have the popup html windows positioned exactly as I want them. They also open and close the way I want them.

    But... eeekk!!! One last problem remains. The html files I use in the popup windows also contain a wav sound file. And in some of the browsers I have tried the image and the popup window html go away, but the sound continues, even though the popup window has been closed with the "close" button, and if clicking on another thumbnail the two sounds, one from the previous popup and the other from new popup, mix in gibberish. When I say "some" of the browsers I have, I mean IE 7, safari, and opera, have the problem. While, Firefox and Netscape 9.0 work exactly as I want them to work!! Since when closing the popup window in those two browsers, using the exact same code, the sound from the popup url also stops!!

    Weird, but apparently there is some conflict between browsers. You've been so patient, I wonder if you have any ideas so this will work across all browsers.


    <style type="text/css">

    .popup {
    border: solid 1px #333;
    font-family: Tahoma;
    font-size: 12px;
    display: none;
    position: absolute;
    z-index: 60;

    .popuptitle {
    position: relative;
    background: blue;
    color: white;
    font-weight: bold;
    height: 15px;
    padding: 5px;

    .popuptitle input {
    position: absolute;
    font-size: 75%;
    right: 2px;
    top: 2px;

    .popupbody {
    background: #ddd;
    padding: 5px;
    text-align: center;

    #popup1 { top: 0px; left: 50px; }
    #popup1 iframe { width: 650px; height: 650px }


    <script type="text/javascript">
    function popupWindow(o,u)
    var obj = document.getElementById(o);
    if(u) {
    obj.style.display = 'block';
    obj.style.display = 'none';



    <h1>Popup Style Window Using Elements</h1>

    <img src="bird.jpg" height="50" width="50" onClick="popupWindow('popup1','bird.html');"></a></a>

    <div id="popup1" class="popup">
    <div class="popuptitle">Bird<input type="button" value="close" onClick="popupWindow('popup1');">
    <iframe name="popup1" class="popupbody"></iframe>

    Thanks again.

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.11200 seconds
  • Memory Usage 2,886KB
  • Queries Executed 13 (?)
More Information
Template Usage (32):
  • (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)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (6)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./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
  • ./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 (70):
  • 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
  • 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