JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 30th, 2002, 04:01 AM
michelle michelle is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Posts: 400 michelle User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Javascript help

Hi, I didn't know why this script doesn't work. I presume it basically reposition my layer when screen resolution or page resize occurs.

PHP Code:
var activeSub=0;
var 
SubNum=0;

function 
reDo(){ window.location.reload() }
    
window.onresize reDo;


    
//Define global variables

        
var timerID null;
        var 
timerOn false;
        var 
timecount 200;
        var 
what null;
        var 
newbrowser true;
        var 
check false;

        function 
init(){
        
//  alert ("Running Init");
          
if (document.layers) {
                      
//  alert ("Running Netscape 4");
                        
layerRef="document.layers";
                        
styleSwitch="";
                        
visibleVar="show";
            
screenSize window.innerWidth;
            
what ="ns4";


          }else if(
document.all){
                      
//  alert ("Running IE");
                        
layerRef="document.all";
                        
styleSwitch=".style";
                        
visibleVar="visible";
            
screenSize document.body.clientWidth 18;
            
what ="ie";

          }else if(
document.getElementById){
                      
//  alert ("Running Netscape 6");
                        
layerRef="document.getElementByID";
                        
styleSwitch=".style";
                        
visibleVar="visible";
            
what="moz";
          
          }else{
              
//alert("Older than 4.0 browser.");
            
what="none";
            
newbrowser false;
          }
        
        
check true;
           }

    
// Turns the layers on and off
        
function showLayer(layerName){
            if(
check){
                if (
what =="none"){
                    return;
                    }
                else if (
what == "moz"){
                    
document.getElementById(layerName).style.visibility="visible";
                    }
                else{
                  eval(
layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');
                  }
         }
            else {
// alert ("Please wait for the page to finish loading.");
                
return;}
        }

        function 
hideLayer(layerName){
            if(
check){
                if (
what =="none"){
                    return;
                    }
                else if (
what == "moz"){
                    
document.getElementById(layerName).style.visibility="hidden";
                    }
                else{
                  eval(
layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"');
                }
        
            }
            else {
// alert ("Please wait for the page to finish loading.");
                
return;}
        }


        function 
hideAll(){
                
hideLayer('layer1');
                }


        function 
startTime() {
            if (
timerOn == false) {
                
timerID=setTimeout"hideAll()" timecount);
                
timerOn true;

            }

        }


        function 
stopTime() {
            if (
timerOn) {
                
clearTimeout(timerID);
                
timerID null;
                
timerOn false;
            }
        }

        function 
onLoad(){
            
init();
            
            } 


But it doesn't work. Am I doing wrong anywhere? Here's my style:

PHP Code:
#layer1 { background-color : #666666;
   
layer-background-color #666666;
   
width 138px;
   
top 99px;
   
left 973px;
   
position absolute;
   
z-index 90;
   
visibility hidden;


Reply With Quote
  #2  
Old September 2nd, 2002, 12:47 AM
bricker42 bricker42 is offline
Moderator =(8^(|)
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2002
Location: Sacramento, CA
Posts: 1,710 bricker42 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 38 sec
Reputation Power: 8
Send a message via AIM to bricker42
Which part of it doesn't work? What's it not doing?

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > Javascript help


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT