Solved

child window size control for resolution

Posted on 2004-09-20
3
140 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 500 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
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…

777 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