`
wsql
  • 浏览: 11810306 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
文章分类
社区版块
存档分类
最新评论

dom 学习笔记2

 
阅读更多

十四、 粘贴板处理
1、oncopy 复制事件 例如: <body oncopy="alert('禁止复制'); return false;">
2、onpaste 粘贴事件 例如: <input type="text" value="" onpaste="alert('请手动输入'); return false;" />
3、oncopy="setTimeout('modifyClipboard()',100)" 用户复制动作发生0.1秒以后在去修改粘贴板中的内容
//修改剪切板中的内容 使得复制的时候添加自己的内容
function modifyClipboard() {
var txt = clipboardData.getData('Text');
clipboardData.setData('Text', clipboardData.getData('Text') + '本文来自liyangfd的博客' + location.href);

}
十五、前进后退导航
1、window.history.back() 后退 或者window.history.go(-1);
2、window.history.forward() 前进 或者window.history.go(1);

十六、Document 属性
1、document是window对象的一个属性
2、write: 想文档中写内容 必须在页面加载的时候write才会与原有的内容融合在一起,经常在广告代码、整合资源代码中使用
内容联盟、广告代码 不需要主页面的站长去维护内容,只要被嵌入的js内容提供商修改 显示的内容就改变了
3、writeIn:比write多了个回车

十七、document 方法
1、控件ID.value 这个控件不能在form中 在form中的必须为 form1.控件ID.value 因此引出
2、document.getElementById("txt1").value 取出控件的值 无论在不在form中
3、document.getElementsByName("").value 根据名字取出对象 由于RadioButton名字一致所以返回是一个数组
4、document.getElementsByTagName("").value
二十一、 parseInt 将字符串转换为数字 参数为 字符串 ,基数

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics