JAVASCRIPT

애니위즈 2011. 3. 31. 18:23

 

자바스크립트

           <script>                   
                        function pop_scroll()
                        {              
                            interval = setInterval("pop_view()", 10000);                     
                        }
                       
                        function pop_view(){                        
                                var id = "";                          
                                for(j = 1; j <3; j++){
                                    id = "divName_"+ j;                            
                                     disp = document.getElementById(id).style.display;   
                                             
                                     if(disp == "block"){
                                          if(j == 1 ) {
                                              document.getElementById("divName_1").style.display = "none";
                                              document.getElementById("divName_2").style.display = "block";
                                             
                                              break;
                                          }                                      
                                           if(j == 2 ) {
                                              document.getElementById("divName_1").style.display = "block";
                                              document.getElementById("divName_2").style.display = "none";
                                             
                                              break;
                                          }
                                         
                                        
                                       
                                     }
                                }          
             }
            
              pop_scroll();
                       
       </script>

 

div적용

 <div id="divName_1" style="display:block" >첫번째 보여질 DIV </div>

 <div id="divName_2" style="display:none" >두번째 보여질 DIV </div>   

웹프로그램개발,웹솔루션 애니위즈(http://anywiz.co.kr)