Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

child window size control for resolution

Posted on 2004-09-20
3
Medium Priority
?
143 Views
Last Modified: 2011-10-03
I have gone through the work for controlling the table size for various resolution with the help from experts. Now I meet another problem.
There are some child window to be displayed when readers click and the script is:

<script type="text/javascript">
<!--//hide
function SHOW_MEMO() {
window.open("memo.htm", "mypage", "height=600, width=700, top=0,left=0");
}
//-->
</script>
.
.
<a href="javascript:SHOW_LAYOUT()"onmouseover="window.status='click to see!'; return true" onMouseOut="window.status=' '; return true">MEMO</a>

How to set the percentage with this type of child window?
0
Comment
Question by:fhtong
3 Comments
 
LVL 13

Expert Comment

by:cLFlaVA
ID: 12102975

a) what do you mean by "set the percentage"
b) is "SHOW_LAYOUT()" above supposed to be "SHOW_MEMO()"?
0
 

Author Comment

by:fhtong
ID: 12108289
clFlaVA,

I mean that if the resolution is 800, then the child window will be height=600 width=700, if the resolution is 1024 or up, then then the child window will be height=768 width=900.

It would be better to use percentage so that other resolution can have the same displaying ratio.
0
 
LVL 5

Accepted Solution

by:
apparition earned 1500 total points
ID: 12111569
Try This,


<script type="text/javascript">
<!--//hide
function SHOW_LAYOUT() {
      if (navigator.appVersion.indexOf("4.") != -1 && 
                navigator.appName.indexOf("Explorer") != -1) {
           ScrnSize = screen.width + "x" + screen.height;
        }
      if (navigator.appVersion.indexOf("4.") != -1 && 
                navigator.appName.indexOf("Netscape") != -1) {
           ScrnSize = screen.width + "x" + (screen.height + 19); //Netscape sees 19 pixels less on Height
        }
      switch(ScrnSize) {
              case "640x480":   width=400;
             case "800x600":   width=600;
          case "1024x768":  width=800;
          case "1152x864":  width=1000;
            case "1280x1024": width=1100;
          case "1600x1200": width=1200;
            default:          height=400;
    }
      window.open("memo.htm", "mypage", "height=500, width=" + width + ", top=0,left=0");
}
//-->
</script>
.
.
<a href="javascript:SHOW_LAYOUT()"onmouseover="window.status='click to see!'; return true" onMouseOut="window.status=' '; return true">MEMO</a>
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question