Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Screen Size Detection versus inches ?

Posted on 1998-01-23
1
Medium Priority
?
447 Views
Last Modified: 2010-05-18
Hello. I am a little confused here.
I have one left frame and one right frame (the main one)
I tried to use the screen size detection script but it doesn't work properly. I am working on a 17 inches monitor set at 1024 x 780. and a 15 inches set a 800 x 600.
the browser pulls out the same file menuN4_800.html.

here is the script : I use the detection on netcape 4 only in this script.

<SCRIPT>
                      // if can't detect let think it have at least:
                      var w=640
                      var mode="640"
                      //let's try for any netscape:
                           if((navigator.javaEnabled()==true)&&(navigator.appName.indexOf("Netscape")!=-1))
                      {w=java.awt.Toolkit.getDefaultToolkit().getScreenSize().width;}
                      </SCRIPT>

<SCRIPT LANGUAGE="javaScript1.2">
                      //for MIE4 and NN4 we can do it so:
                      w=screen.width
                      </SCRIPT>

<SCRIPT>
                      if(w>=1280) mode ='1280';
                      if(w>=1024) mode ='1024';
                      if(w>=800) mode = '800';  
                      </SCRIPT>

<SCRIPT LANGUAGE="JavaScript">
          bName = navigator.appName;
     bVer = parseInt(navigator.appVersion);
             if      (bName == "Netscape" && bVer == 3) ver = "n3";
             else if (bName == "Netscape" && bVer == 4) ver = "n4";
             else if (bName == "Netscape" && bVer == 2) ver = "n2";
             else if (bName == "Microsoft Internet Explorer" && bVer >= 2) ver = "e3";
             if (ver == "n3") {
      document.write('<FRAMESET COLS="178,*" FRAMEBORDER="0" FRAMESPACING="0" BORDER="0">' +
                     '<FRAME SRC="menuN3_biz.html" NAME="left" SCROLLING="NO" >' +
                     '<FRAME SRC="main.html" NAME="main" SCROLLING="AUTO">' +
                     '</FRAMESET>');
            }
                                                                   if (ver == "n4") {
      document.write('<FRAMESET COLS="178,*" FRAMEBORDER="0" FRAMESPACING="0" BORDER="0" SCROLLING="NO"  >' +
                     '<FRAME SRC="menuN4_biz.html" NAME="left" SCROLLING="NO" >' +
                     '<FRAME SRC="mainN4_'+mode+'.html" NAME="main" SCROLLING="AUTO">' +
                     '</FRAMESET>');
            }
             if (ver == "n2") {
      document.write('<FRAMESET COLS="178,*" FRAMEBORDER="0" FRAMESPACING="0" BORDER="0">' +
                     '<FRAME SRC="menuN2.html" NAME="left">' +
                     '<FRAME SRC="main.html" NAME="main" SCROLLING="AUTO">' +
                     '</FRAMESET>');
}
                                                                         if (ver == "e3") {
             document.write('<FRAMESET COLS="178,*" FRAMEBORDER="0" FRAMESPACING="0" BORDER="0">' +
                            '<FRAME SRC="menuIE_biz.html" NAME="left">' +
                            '<FRAME SRC="mainIE.html" NAME="main" SCROLLING="AUTO">' +
                            '</FRAMESET>');
             }
     </SCRIPT>

Of course I have 2 different files :
menuN4_800.html and menuN4_1024.html


Thank you for your help
0
Comment
Question by:fana
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 10

Accepted Solution

by:
kollegov earned 100 total points
ID: 1277750
<SCRIPT>
if(w>=1280) mode ='1280';
if(w>=1024) mode ='1024';
if(w>=800) mode = '800';
</SCRIPT>

reason is wrong order in above sevtion of script,
if resolution 1024 it will satisfy both last checks
and last assignment will give you 800!
use following order:

<SCRIPT>
if(w>=800) mode = '800';
if(w>=1024) mode ='1024';
if(w>=1280) mode ='1280';
</SCRIPT>

in this case first two will be passed OK
and last one give you 1024 for w=1024.


0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

610 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