zoukankan      html  css  js  c++  java
  • javascript;Dom相关笔记

    document.ondblclick 页面双击事件
    document.title.charAt(0) 取标题第1个字符串
    window.alert  弹出消息对话框
    window.confirm 显示确定和取消对话框
    window.setInterval 每隔一段时间执行指定的代码
    window.clearInterval 取消setInterval执行
    window.setTimeout 延迟执行一次
    window.navigate('a.htm') 重新导航到指定的地址
    showModalDialog('a.htm') 弹出网页对话框
    location.href  获取路径
    location.href='a.htm' 重定向与navigate跳转一样
    window.location.reload() 刷新页面
    window.event.ctrlKey 判断是否按下CTRL键
    window.event.keyCode 获取按下键盘的ASCII码
    window.event.returnValue=false; 禁止访问
    window.event.srcElement 取得引发事件的控件
    window.event.clientX、clientY 获得鼠标的位置
    clipboardData  对粘贴板操作
    clipboardData.setData('text','内容') 设置粘贴板值
    clipboardData.getData('text')    读取粘贴板中的值
    clipboardData.clearData('text')  清空粘贴板中的值
    window.history.back() 后退
    window.history.forward() 前进
    window.history.go(1) 前进
    window.history.go(-1) 后退
    document.write("") 写入内容
    document.getElementById("") 根据ID获取对象
    document.getElementsByName("") 根据name获取对象数组
    document.getElementsByTagName("") 根据标签获取元素数组
    document.createElement("") 动态创建控件
    document.onclick 可以监听整个页面 body里只能监听有内容地方
    document.body.appendChild(div); 添加div层到body里显示
    document.body.removeChild(div); 从body里把div移除掉
    innerText 元素标签内文本内容
    innerHTML 元素标签内HTML源代码
    this 表示当前发生事件的控件
    this.style.background='red' 单独修改样式
    style.display="none"  不显示 ""空为显示
    style="position:absolute;top:200px;left:200px" 绝对定位
    style="ime-mode:disabled"  禁用输入法,只有IE支持
    setAttribute("a1","") 设定一些Dom元素属性名特殊的属性
    getAttribute("a1") 取值
    javascript:showLogin() 调用JS函数
    var regex1 = new RegExp(".+@.+"); JS中正则表达式
    var regex = /.+@.+/; JS中正则表达式  /……/ 不用转义符
    RegExp.$1 RegExp.$2 分组调用取值

    parseInt(txt1, 10) 转INT32类型
    onload 网页加载完毕时触发
    onunload 网页关闭(或者离开)后触发
    onbeforeunload="window.event.returnValue='真的要离开吗!' 关闭时触发
    oncopy  复制触发
    onpaste 粘贴触发
    oncopy="alert('禁止复制!');return false;"
    onpaste="alert('禁止粘贴!');return false;"
    onfocus 焦点进入控件事件
    onblur 焦点离开控件事件
    onmouseover 鼠标进入控件的事件
    onmouseout 鼠标离开控件时的事件

  • 相关阅读:
    一张图片入门Python
    4.1. 如何在Windows环境下开发Python
    你必须知道的EF知识和经验
    XUnit的使用
    如何使用NUnit
    Entity Framework 不支持DefaultValue
    Have You Ever Wondered About the Difference Between NOT NULL and DEFAULT?
    Validation failed for one or more entities. See 'EntityValidationErrors' property for more details
    Entity Framework 与多线程
    sqlite中的自增主键
  • 原文地址:https://www.cnblogs.com/han1982/p/3224249.html
Copyright © 2011-2022 走看看