JavaScript - Need Help With Javascript Popup Window Always Staying On Top Of Other Windows
I currently have a popup window that works fine but while that window is up on top and I click on another link that opens another window the popup goes behind that window. How do I code to get the popup window to always stay on top no matter what window I open up with the code I have below:
Code: <script language="javascript" type="text/javascript"> function test() { setTimeout("self.focus()",3000) } function open_new_window() { //new_window = open("","hoverwindow","width=300,height=200,left=10,top=10"); new_window = window.showModelessDialog("","hoverwindow","width=300,height=200,left=10,top=10"); new_window.focus(); // open new document new_window.document.open(); // Text of the new document // Replace your " with ' or \" or your document.write statements will fail new_window.document.write("<html><title>JavaScript New Window</title>"); new_window.document.write("<body onBlur = "test();" bgcolor=\"#FFFFFF\">"); new_window.document.write ("Week 1 Question".bold()); new_window.document.write("<table><tr><td>Is there a role of process owner in your organization? If not, how will you overcome this challenge? Why do you need process owners as a Lean Six Sigma Green Belt Project Leader?</td></tr></table>"); new_window.document.write("<br />"); new_window.document.write("</body></html>"); // close the document new_window.document.close(); } // This is the function that will close the // new window when the mouse is moved off the link function close_window() { new_window.close(); } </script> Similar TutorialsDear friends, I am using a Javascript which perfectly worked in all relevant browsers, including IE6 and IE7. Its advantage has been to be able to specify the window-size + to decide, whether there should be scrollbars or the option to resize it. It is also fully standards-compliant. It opens a new popup window and is triggered via the rel="popup" or rel="popup nofollow" attributes in the specified external links, e.g.: Code: <a href="http://www.codingforums.com/" rel="popup">CodingForums</a> <a href="http://www.codingforums.com/" rel="popup nofollow">CodingForums</a> The code however does not do its job in IE8. It follows the link, but does so in the old window, not a new popup window, and thus recurs to standard behavior of links. Here is the Javascript-Code, included in the header: Code: var properties = { width: 900, height: 450, scrollbars: 'yes', resizable: 'yes' }; function popup(){ var link = this.getAttribute( 'href' ); var prop_str = ''; for( prop in properties ){ prop_str = prop_str + prop + '=' + properties[prop] + ','; } prop_str = prop_str.substr( 0, prop_str.length - 1 ); var newWindow = window.open( link, '_blank', prop_str ); if( newWindow ){ if( newWindow.focus ) newWindow.focus(); return false; } return true; } function setupPopups(){ var links = document.getElementsByTagName( 'a' ); for( var i=0; i<links.length; i++ ){ if( links[i].getAttribute( 'rel' ) && (links[i].getAttribute( 'rel' ) == 'popup' || links[i].getAttribute( 'rel' ) == 'popup nofollow')) links[i].onclick = popup; } } window.onload = function(){ setupPopups(); } Since I am not an expert, I would greatly appreciate help to make this efficent code workable in IE8. Thanks in advance! CodeMat Hi, I have a code that opens a new window from a flash movie. The window opens fine, but the parent window goes blank and displays this on the top left of the screen: [object] (in IE8) [object Window] (in Firefox) Does anyone know what I'm missing? This is the code for the button that opens the new window: on (release) { getURL ("javascript:window.open('/RG_Map.pdf','RGCommunityMap','width=700,height=700');"); } I have searched high and low to find this script. Not having much luck at all. What i want to do is, when someone clicks a link the image pops up on screen in its own nice window smack down in the middle of the screen over top of the website. I want it to look neat tho, best example i can find is @ curse.com http://wow.curse.com/downloads/wow-a...st-helper.aspx If you click that link and scroll down to the screen shot section and click on one of the images you can see how nice and professional it looks. How can i accomplish this? Thanks so much in advance~ In the past I write the jave script to popup windows in the browser for tell our visitor about news & event but now most of browser will block popup by default. Someone can show me an example about the professional popup with out the block.Thank you
I have the code below in my popup window which currently brings up a blank page in the background as the main window. Instead I want the popup to come up but the original page I left is in the background as the main window. Does anyone know how I can do that with the code I currently have. Code: <html> <head> <title>JavaScript Popup Example 3</title> </head> <script type="text/javascript"> function poponload() { testwindow = window.open("", "mywindow", "location=0,status=0,scrollbars=0,width=350,height=400"); testwindow.moveTo(0, 0); testwindow.document.write('<h1>Get outta here!</h1><a href="javascript:void(0);" onclick="window.opener.history.go(-1); self.close();">Parent back button</a>'); testwindow.focus(); } </script> <body onload="javascript: poponload()"> </body> </html> Hi Everyone, I have the following problem that I have been trying to figure out for a few hours now and am hoping someone can give me a help out. I am opening a popup - this popup is solely to take an image url and as such has one field. On this 1st popup I have a 'button' which when clicked launches a 2nd popup window containing a file browser. The user selects the file by double clicking on the image they want, the url is passed back to the 1st popup, poulating the field and the 2nd popup is closed. Work perfectly in FF etc.. but in IE7 and IE8 it will not work. I am using the following function, linked to the button in the 1st popup, to open the 2nd popup window pass across the name of the field and the window object to the 2nd window. Code: function popupTwoInit(file_path, field_name, win) { var w = window.open(file_path, null, 'toolbar=yes,menubar=yes,width=900,height=600'); w.fileFileField = field_name; w.fileFileWin = win; } Where w is holding the window object created by the window.open, field_name is the name of the field on the popup that I wish to pass back a value to and win is the window object of the 1st popup. I am using this function as the callback to poulate the field in the 1st dialog after an image in the 2nd dialog has been selected: Code: filebrowser_callback(url) { window.fileFileWin.document.forms[0].elements[window.fileFileField].value = url; window.fileFileWin.focus(); window.close(); } So this function accesses the passed through window object and field name from the window.open function, populates the field, gives the 1st popup focus and closes the 2nd popup. I thought about using opener in the 2nd popup to access the window object and field in the 1st popup but opener seems to refer to the main page in the browser - perhaps because I am using 2 popups OR I have got that wrong. Like I say works perfectly in FF but IE is always undefined for both 'window.fileFileWin' & 'window.fileFileField' which seems to suggest that the object is not interpreted by IE in the first function? I am a PHP developer with limited Javascript knowledge so any help would be great. Thanks very much. Hi, I'm kinda hoping this is possible but haven't found any reference to it... I have a parent page that opens a popup on click that launches a sidebar navigation on the right of the screen and resizes the parent page. What I am wanting to do is create a second popup (approx 250px high) that opens below the navigation (which is only around 600px high) but I have noticed that even when you have no status bar in the popup windows, they can still end up overlapping because of additional tools or plugins that the viewer has in their browser. Is there any way to get the popups to butt up against each other instead of overlapping? More like a relative popup? Any assistance would be appreciated. :-) This is my first time writing any JavaScript, so I am not very familiar with the language. I want to make a window be kept at the back, under all other windows. From what I understand, the method to do this would be window.blur(), but I cannot seem to get it to work. Have I misunderstood the functionality, or am I implementing it wrong? The part of the code I have that currently deals with this (or at least tries) is as follows: Code: <BODY onclick="window.blur()" > <img src="imageurl" id="image"></img> </BODY> I've tried a few other events to trigger this (onmouseover, setInterval, etc.) but no way I've tried has worked. So, is blur() the right method to do this? have I done something wrong in the implementation? Any help and guidance is appreciated. Backstory (if it should matter for some reason) : I found a webpage ( here and here ) that generates an image of the Earth as seen from space at a given time and I wanted to place that image, updated on a regular basis, as my desktop image. I looked around for a way to do it, but as far as I could find, there was no way to do it easily in Windows XP. Thus, I am now using Samurize (a program for overlaying graphics etc. at your desktop) to create a browser window that loads a html file that periodically updates the image. While this window cannot be moved and has no borders, it can be selected and if it is selected, the image is brought to the front, overlapping any other windows. I wish to make it such that this cannot happen; I have tried configuring Samurize as well as asking for help on their forums, but no luck so far. I guess this case applies to both popup windows opened by window.open() and by showModalWindow(). I have two buttons in popup window, "Cancel" and "Save". If the user clicks either button, there is a "process" at parent window before close() at popup being called. The problem now is, if the user click the "X" sign at top right corner of that popup window, how to trigger the "process"? I think I can do nothing in popup window since the closure is unexpected programmatically. Can I put some kind of listener in parent window to detect if popup is closed? Hi All How popup windows are made using Javascript? I am not talking about the popups cretaed using window.open. I am talking about the window which appears to display some advertisements in most of the sites. Charles Hey there everybody! I'm learning javascript, and I am having trouble figuring out how to do this. Maybe you guys can help me out. What I need is for my main page to have a text field. Above the text field there should be a set of images for bold, italics, underline, etc; when you click on them it inserts the html code <b></b> at the cursor point. Next I want there to be a link, that when clicked will open a popup box with smileys. When you click on one of the smiley images it should insert the smiley code (example :smile: ) into the parent window text field. And would it be possible to make that work with pages of emotes? Or perhaps a second popup window? I hope I explained that without it sounding confusing. I would really appreciate any help. Here is my basic code, it does not include a popup code however. Code: <html> <script type="text/javascript"> function insert(el,ins) { window.lstText={}; if (el.setSelectionRange){ el.value = el.value.substring(0,el.selectionStart) + ins + el.value.substring(el.selectionStart,el.selectionEnd) + el.value.substring(el.selectionEnd,el.value.length); } else if (document.selection && document.selection.createRange) { el.focus(); var range = document.selection.createRange(); range.text = ins + range.text; } } </script> <body> <form> <textarea rows="20" cols="100" name="txt1" onfocus="window.lstText=this;"> This is sample text, click anywhere in here then choose on of the buttons above to see text inserted. </textarea><br /><br /> <img src="http://i570.photobucket.com/albums/ss141/vwcorrado/Docs_smiley.jpg" onclick="insert(window.lstText,'hello')"> <input type="button" value="hi" onclick="insert(window.lstText,'hi')"> <br /> </form> </body> </html> I was wanting to know if it was possible to use eventlistener on a popup window? What i am wanting to do is this. My script runs functions then uses window.open to open a specified url when the window opens i want it to alert a message for useage of said url.
Hi, I desperately need help after hours of reading 1000s of forums just to be able to have a thumbnail which will enlarge in a new window. I've found this script in one of the forums, and I am trying to apply it to my page. But when I click on a thumbnail, although it's opening a pop-up window, it also enlarges the image in the current browser. How should I fix this? I also need to do the same thing with a .swf file. How can I have a flash movie enlarge when clicked? Any help is appreciated thanks in advance!! <HTML> <Head> <Script type="text/javascript"> var largerView = ""; var winToggle = false; function openFullSize(Pix,isDesc){ if (winToggle){largerView.close()} document.getElementById('nullIMG').src = Pix; var wStr = document.getElementById('nullIMG').width; var offsetW = wStr; wStr = wStr+20; wStr = "width="+wStr; var hStr = document.getElementById('nullIMG').height; var offsetH = hStr; hStr = hStr+20; hStr = "height="+hStr; var lStr = (screen.width-50-offsetW)/2; lStr = "left="+lStr; var tStr = (screen.availHeight-50-offsetH)/2; tStr = "top="+tStr; largerView = window.open(Pix,"FullSize","toolbar=0,status=0,"+tStr+","+lStr+","+wStr+","+hStr+""); largerView.document.title = isDesc; winToggle = true; } function buildSupport(){ var styleStr = "<style>.thumb{cursorointer;border:solid blue 2px}</style>" var divStr = "<Div style='Position:Absolute;Top:-2000'><IMG ID='nullIMG'> </Div>" document.write(divStr); document.write(styleStr); } buildSupport(); window.onunload=function(){ if (winToggle && !largerView.closed){largerView.close()} } </Script> </Head> <Body> <Img Src='1/Any.jpg' width='120' height='90' class='thumb' onclick="openFullSize(this.src,'This is a description')" alt='Click to enlarge'> <Img Src='1/Some.jpg' width='120' height='90' class='thumb' onclick="openFullSize(this.src,'This is another description')" alt='Click to enlarge'> <!-- The following line must be the LAST line in the Body --> <Script> document.getElementById('nullIMG').src = document.images[1].src </Script> </Body> </HTML> I've changed the last part to: <Img Src='images/Any.jpg' width='120' height='90' class='thumb' onclick="openFullSize(this.src,'This is a description')" alt='Click to enlarge'> <Img Src='images/Some.jpg' width='120' height='90' class='thumb' onclick="openFullSize(this.src,'This is another description')" alt='Click to enlarge'> <!-- The following line must be the LAST line in the Body --> <Script> document.getElementById('nullIMG').src = document.images.src </Script> </Body> </HTML> If anyone could please help me with this basic feature, I would much appreciate it! I have this function: Code: function popupWin(href) { window.open(href, "popup", "width=770,height=675"); return; } but when I run it, it opens in the same window. I'm really new to Javascript, and I'm sure it's a basic fix, I just can't seem to figure it out. Thank you!! Hi I want to create a popup that is completely contained within the page (so i guess its not really a popup). I'm looking for something where if a button is clicked, a small box will come up in the current window and become the active window, while the original window is visible but not active. It's hard to explain, but its a popup that is contained in the same window. And when the user presses okay or cancel on the "popup" window. They return to where they were in the original window. Is this possible? How would I do it? Thanks In my page i have to open the popup window when i do on click. one place it is opening correctly. but in another case not able to open. Can you give me the solution on this one. In the following html code i am able to open the popup window. Code: <td colspan=2 width=90% background="graphics/barbkg.gif" class=fcCalMonthDay_gren height=16 align=center> <div id=fcContentLegned style="display:block;"><a href=# onClick="javascript:OZ_openBrWin4('ozLOVNoteCenter.jsp')">Daily Notes Center</a></div> </td> but in the following javascript method not able to open the popup window when i do onclick. Code: var currContentView = 'calDailyNotes'; // calOrg, calPsn, calOpp function selectContent( curr ) { if ( fcCalRefreshInProgress == 1 ) return; currContentView = curr; document.getElementById('calDailyNotes').className=''; document.getElementById('calOrg').className=''; document.getElementById('calPsn').className=''; document.getElementById(curr).className='genTblContentCellCal'; if ( curr == 'calDailyNotes' ) document.getElementById('fcContentLegned').innerHTML = '<a href="#" onClick="javascript:OZ_openBrWin4(ozLOVNoteCenter.jsp)">Daily Notes Center</a>'; // Here i am not able to open the popup window. else if ( curr == 'calOrg' ) document.getElementById('fcContentLegned').innerHTML = 'Recent Organizations'; else if ( curr == 'calPsn' ) document.getElementById('fcContentLegned').innerHTML = 'Recent Contacts'; fc_refresh_content_view('<%=submitUrlNotes%>&refreshview=Y&view='+curr, '<%=ozDay.renderDayKey(_ahsPage)%>' ); } thanks in advance... Hello everyone... I need "No-Block PopUp Window" for my web site.. for example if users open my sites another sites show or opens for them.. even a full page site like full pages ads.. and it be like One time per hour or more.. I found some script like that but some of them being blocked by IE or other browsers.. if anyone has kinda this JS code.. Please share it.. Thanks a lot Hello , everyone. Was wondering if you can put a single popup that could appear to many visitors to a site at the same time , regardless of the page you 're browsing . Is there a chance to do it in JavaScript or another language ? How could i do it? Iappreciate the help .
I have a problem in centering my popup window. I want it centered in the page when it pops up. The problem is in the code that is red. Here's a part of my script: if (counter == 0) { var myRes = "<html><head>\n"; myRes += "<title>Popup Window</title>\n"; myRes += "</head><body>\n"; myRes += "<div style='text-align:center'>\n"; myRes += "<p>Search character '<b>" + searchChar + "</b>' not found in text string!</p>\n"; myRes += "<input type='button' value='Close Window' onclick='window.close()'>\n"; myRes += "</div>\n"; myRes += "</body>\n</html>"; var popup = window.open("", "Popup", "top=10,left=300,width=300,height=100"); popup.focus(); popup.document.write(myRes); popup.document.close(); Hopefully someone can help a newbie with this. I have a map with onclick areas. When you click these areas, a popup window displays a text file. This is rather cumbersome, so I thought of using a popup box instead of a window and linking this to an onmouseover and onmouseout event. The only problem I have is trying to find out how to dump the contents of the text file into the popup box using the simplest means. The URL of the map I am trying to do this with is: http://www.intercitycharters.com/Weather/Summary.php Any suggestions? |