Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

showModelessDialog AND "modal" attribute

Status
Not open for further replies.

toohottie

Programmer
Jul 25, 2006
5
US
I have been struggling with this for a few days now and was hoping somebody had some advice. I have my webpage up now, and the problem I am having is that I have a javascript that opens a new window. This all works fine, but the problem I am running into is that when the user clicks on the thumnail, the new window opens (this works fine) but when the user clicks on another thumbnail, the window goes behind the main window. This causes the user to get lost in the site, not knowing where the new gallery window is located. So I am trying to figure out how to keep the new window on top of the main window.

Here is an example:


So what I have figured out is how to make this method work in IE. Using the showModelessDialog method.

Here is an example:
(if you click the "Click Here For Nutritional Information" link, open the window, and then click back to the main window, the showModelessDialog works by staying on top of the main window)
(This only works in Internet Explorer)

I have also gotton a separate way to work but it only works in Firefox. I used the attribute with a "onClick="window.open()", (at the end) 'modal=yes'.

Here is that example:
(It works the same as above)
(but it only works in firefox, NOT IE)

So what I am struggling with is how to get it to work on both IE and Firfox???
 
You could always just do this:
Code:
onClick="javascript:if(navigator.userAgent.indexOf('Firefox')!=-1) window.open('NutritionFacts/RESPECTVan.aspx', 'newWin', 'width=600, height=510, toolbar=0, directories=0, status=0, scrollbars=0, resizable=0, menubar=0, modal=yes'); elseif(navigator.userAgent.indexOf('MSIE')!=-1)openNewWindow('NutritionFacts/EFASmall.aspx', 'modal=yes');"
I haven't tested that code, but you should get the idea. Basically it checks which browser it is and acts accordingly.
 
would i do that within the head/script tags, or hardcode it directly into the html?
 
I got it working dude, its not perfect yet, but it will do for now. I already appreciate the help, and it took me up until the last message i wrote to realize exactly what you were talking about. If you have any other suggestions to make my code a little more workable, or a little more efficient, i would appreciate it. I already appreciate the help!

 
Actually I didnt get it, the one work for Firefox, but it doesnt work in IE. If you hit any navigation in the popup window, it takes you to another page rather than staying in the same window.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top