Asp.net 载入时执行JavaScript函数

Asp.net  载入时执行JavaScript函数             

                     Page.RegisterStartupScript("js", "<script   language=javascript>showtimes();</script>");

 

载入窗体是全屏窗口

 <script type="text/javascript" language="javascript">
        function   toFull(){  
        if(window.name=="fullscreen")return;  
          var   a   =window.open("","fullscreen","fullscreen=yes")  
          a.location   =   window.location.href  
          window.opener=null  
          window.close()  
          }
        toFull();
    </script>

 

div显示N秒后自动消失


<script language="javascript" type="text/javascript">
// <!CDATA[
 function showtimes(x){

   var now=new Date();
   var str="现在时间为:";
   var hour=now.getHours();
   var minutes=now.getMinutes();
   var seconds=now.getSeconds();
   str=str+hour;
   str=str+(minutes<10?":0":":")+minutes;
   str=str+(seconds<10?":0":":")+seconds;
   //tim.innerHTML=str;
   var ctimer=setTimeout('showtimes()',960);
   if (seconds>30)
 { 
   divP.style.display="none";
   divW.style.display="";
 }
 else
 {
     divP.style.display="";
     divW.style.display="none";
 }
 } 
//-->
</script>

posted @ 2009-08-31 21:02  叁劈大计划  阅读(646)  评论(0编辑  收藏  举报