home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 1999 July / APC47-1.ISO / workshop / win95 / pws / iis4_02.cab / JSBrowser.js < prev    next >
Encoding:
JavaScript  |  1997-10-19  |  1.8 KB  |  91 lines

  1. //open
  2.  
  3. var POP = true;
  4.  
  5. //browser style
  6. var TDIR = 0
  7. var TFILE = 1
  8.  
  9. //system font size
  10. var SMALL = 0
  11. var LARGE = 1
  12.  
  13. function BrowserObj(pathCntrl,open,browsertype,sysfontsize)
  14.     {    
  15.         this.browsertype = browsertype;
  16.         this.sysfontsize = sysfontsize;
  17.         this.currentFile = "";
  18.                 
  19.                         
  20.         if (pathCntrl != null)
  21.             {
  22.             this.currentPath = pathCntrl.value;
  23.             this.lastpath = pathCntrl.value;
  24.             this.pathCntrl = pathCntrl;
  25.             }
  26.         else
  27.             {
  28.             this.currentPath = "";
  29.             this.lastPath = "";
  30.             }
  31.             
  32.         
  33.         this.BrowserObjSetPath = BrowserObjSetPath;    
  34.         this.BrowserObjOpen = BrowserObjOpen;
  35.         
  36.         if (open)
  37.             {
  38.             BrowserObjOpen();
  39.             }    
  40.     }
  41.  
  42. function BrowserObjPop(title, width, height, filename)
  43.     {
  44.  
  45.         thefile=(filename + ".asp");
  46.         thefile="JSBrowser/JSBrwPop.asp?pg="+thefile;
  47.         var browser = navigator.appName;
  48.         if (JSBrowser.sysfontsize == LARGE){
  49.             width += 50;
  50.             height += 50;
  51.         }
  52.         if (browser.indexOf("Microsoft") == -1)
  53.             {        
  54.             width += 35;
  55.             height += 50;
  56.             }
  57.         popbox=window.open(thefile,title,"toolbar=no,scrollbars=yes,directories=no,menubar=no,width="+width+",height="+height);
  58.         popbox.opener = self;
  59.         
  60.     }
  61.     
  62. function BrowserObjOpen()
  63.     {
  64.         BrowserObjPop('Browser',470,275,'JSBrowser');
  65.     }
  66.  
  67. function BrowserObjSetPath()
  68.     {
  69.     
  70.         if (JSBrowser.browsertype == TDIR)
  71.             {
  72.             JSBrowser.pathCntrl.value = JSBrowser.currentPath;         
  73.             }
  74.         else
  75.             {
  76.             currentPath = JSBrowser.currentPath;
  77.  
  78.             if (currentPath.lastIndexOf("\\") == currentPath.length-1)
  79.                 {
  80.                     JSBrowser.pathCntrl.value = currentPath + JSBrowser.currentFile;
  81.                 }
  82.             else
  83.                 {
  84.                     JSBrowser.pathCntrl.value = currentPath + "\\" + JSBrowser.currentFile;                
  85.                 }
  86.             }
  87.         JSBrowser.pathCntrl.focus();
  88.         JSBrowser.pathCntrl.blur();        
  89.     }    
  90.     
  91. JSBrowser = new BrowserObj(null,false,TDIR,SMALL);