JS-객체, 브라우저 객체

2959 단어
이벤트 개체(Event)
     DOM 
    1.type:                  
    2.target:                
    3.stopPropagation():     
    4.preventDefault():      
        
document.getElementById("btn1").addEventListener("click",showType); document.getElementById("div").addEventListener("click",showDiv); function showType(event){ //alert(event.type); alert(event.target); event.stopPropagation();// } function showDiv(){ alert("div"); }

브라우저 객체 번호


1. window 객체 #######
        window.innerWidth     
        window.innerHeight    
        window.open()    
            window.open("index.html"," "," ");
        window.close()   

2. 타이머
         :
        setInterval() 
        clearInterval() setInterval() 
        
        

var myTime = setInterval(function(){ getTime(); },1000); function getTime(){ var d = new Date(); var t = d.toLocaleTimeString(); document.getElementById("ptime").innerHTML = t; } function stopTime(){ clearInterval(myTime); } setTimeout() clearTimeout() setTimeout()

3.History对象
        window.history  (url) 
         :
            history.back()       
            history.forward()    
            history.go()         
        EXP:
            
            
                function goceshi(){
                    history.back();
                }
            

4.Location 객체 #######
        window.location  (url), 
         :
            location.hostname        web 
            location.pathname        
            location.port            web 
            location.protocol        web (http:// https://)
            location.href            URL
            location.assign()        
            window.location.hostname;
            location.assign(url);

5.Screen 객체
        window.screen  
         :
            screen.availWidth        
            screen.availHeight       
            screen.Height            
            screen.Width             
            
                document.write(" :"+screen.availHeight+", :"+screen.availWidth);
                document.write(" :"+screen.height+", :"+screen.width);
            

좋은 웹페이지 즐겨찾기