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>

  • 相关阅读:
    好玩的SQL
    Oracle常用函数
    树控件DeleteAllItems之前先SelectItem(NULL)
    MFC控件位置调整
    C++中一个0xC0000005访问冲突问题
    为MFC按钮添加各种图片
    LVN_ITEMCHANGED(OnItemchanged)通知响应多次的问题
    android 里边的mk文件的解析
    定义属于自己的标题栏
    block 影响代码执行由上往下执行顺序 从而影响功能的解决
  • 原文地址:https://www.cnblogs.com/pretty/p/1276624.html
Copyright © 2011-2022 走看看