• javascript的一些简单的应用


    location.href;//获取url
    location.search; //获取url中"?"符后的字串

    window.opener; //操作打开窗口的父窗口
    window.opener=null; window.close(); //点击关闭时不弹出系统提示窗口
    window.open("http://g.cn","_blank","height=240,width=340,status=no,location=no,toolbar=no,directories=no,menubar=no");
    <body oncontextmenu=self.event.returnValue=false> 屏蔽右击
    window.status="要多多光临呀!"; //状态栏信息

    document.referrer; //来源网址

    setInterval("startDo()",2000);     setTimeout("startDo()",2000); //设置执行函数倒计时

    <body onselectstart="return false">取消选取、防止复制
    onpaste="return false" 不准粘贴
    oncopy="return false;" oncut="return false;" 防止复制

    <noscript><iframe src=*.html></iframe></noscript>网页将不能被另存为
    <input type=button value=查看网页源代码 onclick="window.location = 'view-source:'+ 'http://www.csdn.net/'">

    <input style="ime-mode:disabled"> 关闭输入法
    oncontextmenu="window.event.returnValue=false" 将彻底屏蔽鼠标右键
    <table oncontextmenu=return(false)><td>no</table> 可用于Table

    <link rel="Shortcut Icon" href="http://blog.163.com/ybbqg@126/blog/favicon.ico"> IE地址栏前换成自己的图标
    <link rel="Bookmark" href="http://blog.163.com/ybbqg@126/blog/favicon.ico">可以在收藏夹中显示出你的图标

    永远都会带着框架
    <script language="JavaScript"><!--
    if (window == top)top.location.href="http://blog.163.com/ybbqg@126/blog/frames.htm"; //frames.htm为框架网页
    // --></script>

    防止被人frame
    <SCRIPT LANGUAGE=JAVASCRIPT><!-- 
    if (top.location != self.location)top.location=self.location;
    // --></SCRIPT>

    <span style="CURSOR: hand" onClick="window.external.addFavorite('http://www.28fy.com','阿爸抚育网)" >加入收藏</span>

    function forward(url,width,height,sizeable,target){     //弹出新窗口方法
    var left = (screen.width/2) - width/2;
    var top = (screen.height/2) - height/2;
    window.open(url, target, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable='+sizeable+',copyhistory=no,width='+width+',height='+height+',left='+left+',top='+top+',screenX='+left+',screenY='+top);
    }

    jquery获取指定列的值:

    $(document).ready(function(){
    $("#tableId tr").each(function(){
    var text = $(this).children("td:eq(1) input").text();   // 获取第二行选中的产品编号
    alert('对比者:'+text);
    if(ob.number==text) return false;   // 产品编号不得重复
    });
    });

    jquery获取id值出现apTotal的元素:

    function accAdd(){
       var total = 0;
       var totalArr = $('input[id*=apTotal]');    // 获取指定的类似id的值
       var len = totalArr.length;
       for(var i=0; i<len; i++)
       {
        total += parseInt(totalArr[i].value);     // 把各个元素的值相加
       }
       $('#asTprice').attr('value',total); // 总和
    }

    javascript捕获键盘上的回车操作
    document.onkeydown = function () {
    <%-- enter : 13 --%>
    if (event.keyCode == 13) {
    var elem = window.document.activeElement;
    var elemType = elem.type;
    //做你想做的
    }
    }
    在form的属性中添加 autocomplete="off",或者在input 属性中添加 autocomplete="off"即可让火狐刷新时清空input表单的值
  • 相关阅读:
    异常总结
    反射
    面试题
    继承多态接口
    JAVA面向对象变成学习!
    学生管理系统---三层架构
    Secondary NameNode
    Hadoop之HDFS
    大数据相关概念二
    大数据相关概念
  • 原文地址:https://www.cnblogs.com/ybbqg/p/2405572.html
Copyright © 2020-2023  润新知