• 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>

  • 相关阅读:
    Java 发送http post 请求
    经纬度计算
    js cookie操作
    wdatepicker默认时间为当前时间
    基于ssm的poi反射bean实例
    jbox小型交互表单(ajax)
    点击图片查看大图(纯js)
    查询物理表字段(mysql)
    离线安装 Cloudera ( CDH 5.x )(转载)
    sed命令详解 (转载)
  • 原文地址:https://www.cnblogs.com/pretty/p/1276624.html
Copyright © 2020-2023  润新知