zoukankan      html  css  js  c++  java
  • JavaScript

    var b = isNaN(document.getElementById("txtCoursesTime").value);
            if(b)
            {
                alert("请在课程学时输入数字!");
                return false;
            }

    事件:onMouseOver="可以是方法hello()"

    target="_blank" 是弹出一个窗口

    window.status:状态拦

    eg:<a href="a.html" onMouseOver="window.status='这是window窗体的状态拦'";return true>

    <div style="120px;height:85px;overflow:scroll;word-break:break-all;"></div> 

    求 Session 的剩余时间
    <script>
    var lefttime=30 //session时间传递
    var tid
    function x()
    {
    lefttime--
    document.all.xx.innerText="剩余:"+lefttime + "秒"
    if(lefttime==0) {clearInterval(tid);window.open("http://dotnet.aspx.cc/")}
    }
    tid = window.setInterval("x()",1000)
    </script>
    <body>
    <div id=xx></div>


    图片缩放:
    <script  language="JavaScript"> 
    <!-- 
    var  flag=false; 
    function  DrawImage(){  ///图片缩放
      var ImgD = event.srcElement;
      if(ImgD.readyState != "complete") return;
         var  image=new  Image(); 
         var my_width;
         var my_height;

         my_width = 200;
         my_height = 200;

         image.src=ImgD.src; 
         if(image.width>0  &&  image.height>0){ 
           flag=true; 
           if(image.width/image.height>=  my_width/my_height){ 
             if(image.width>my_width){     
             ImgD.width=my_width; 
             ImgD.height=(image.height*my_width)/image.width; 
             }else{ 
             ImgD.width=image.width;     
             ImgD.height=image.height; 
             } 
             } 
           else{ 
             if(image.height>my_height){     
             ImgD.height=my_height; 
             ImgD.width=(image.width*my_height)/image.height;           
             }else{ 
             ImgD.width=image.width;     
             ImgD.height=image.height; 
             } 
          
             } 
           } 
    }   
    //--> 
    </script> 
    </head>
    <body>
    <img onReadyStateChange="DrawImage()" src="http://www.toodou.com/_upfile/200604041144126360.jpg" />
    </body>


    AJAX
    <script language=javascript>
        var idx = 0 ;
        function ChkSession()
        {
            var Http = new ActiveXObject("Microsoft.XMLHTTP");
           
           Http.open("GET","test21.aspx",false);
          
           Http.send();
          
            var str = Http.responseText;
           
            if(str=="notnull")
            {
                alert(str);
            }
            else
            {
                 alert(str);
                
                 alert("会话值跟踪时间超时,请重新登录...");//这段代码一直没有运行,往下看,你就知道了            
                
            }
            window.setTimeout('ChkSession()', 1000 );//每一秒钟,请求一次test21.aspx
        }
        </script>

  • 相关阅读:
    从汇编的角度看待const与#define
    从汇编的角度看待变量类型与sizeof的机制
    按字节对齐分析
    堆内存和栈内存的探索
    string源码实现分析
    string源码分析 ——转载 http://blogs.360.cn/360cloud/2012/11/26/linux-gcc-stl-string-in-depth/
    开始了
    atoi函数的实现——面试
    new与malloc的区别,以及内存分配浅析
    [C]C语言中EOF是什么意思?
  • 原文地址:https://www.cnblogs.com/pretty/p/1276624.html
Copyright © 2011-2022 走看看