会员
周边
捐助
新闻
博问
闪存
赞助商
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
ziyou11
博客园
首页
新随笔
联系
订阅
管理
2019年7月20日
用ajax封装同源或跨域的代码
摘要: function ajax(obj){ var defaults = { type : 'get', async : true, url : '#', dataType : 'text', jsonp : 'callback', data : {}, success:function(data){c
阅读全文
posted @ 2019-07-20 14:37 ziyou11
阅读(123)
评论(0)
推荐(0)
编辑
2019年7月11日
获取任意一个元素的任意一个样式属性的值
摘要: <input type="button" value="显示效果" id="btn"/><div id="dv"></div><script src="common.js"></script><script>// my$("btn").onclick=function () {// //获取元素距离
阅读全文
posted @ 2019-07-11 11:36 ziyou11
阅读(194)
评论(0)
推荐(0)
编辑
为元素绑定事件和解绑事件的兼容代码
摘要: <input type="button" value="按钮" id="btn1"/><input type="button" value="干掉第一个按钮的事件" id="btn2"/><script src="common.js"></script><script> //绑定事件的兼容 func
阅读全文
posted @ 2019-07-11 10:24 ziyou11
阅读(133)
评论(0)
推荐(0)
编辑
为元素绑定事件兼容代码
摘要: <input type="button" value="按钮" id="btn"/><script src="common.js"></script><script> //为任意元素.绑定任意的事件, 任意的元素,事件的类型,事件处理函数 function addEventListener(elem
阅读全文
posted @ 2019-07-11 10:16 ziyou11
阅读(87)
评论(0)
推荐(0)
编辑
节点的兼容
摘要: <script> //第一个节点和第一个元素的获取的代码在IE8中可能不支持 //element.firstChild >谷歌和火狐获取的是第一个子几点 //element.firstChile >IE8获取的是第一个子元素 //element.firstElementChild >谷歌和火狐是第一
阅读全文
posted @ 2019-07-11 09:41 ziyou11
阅读(142)
评论(0)
推荐(0)
编辑
2019年7月10日
innerText和innerHTML的区别
摘要: <style> div{ width: 300px; height: 200px; border: 2px dotted red; } </style></head><body><input type="button" value="显示效果" id="btn"/><input type="butt
阅读全文
posted @ 2019-07-10 21:24 ziyou11
阅读(357)
评论(0)
推荐(0)
编辑
innerText和textContent区别和兼容
摘要: <style> div { width: 200px; height: 150px; border: 2px solid red; } </style></head><body> <input type="button" value="设置值" id="btn"/><div id="dv">哦,太神
阅读全文
posted @ 2019-07-10 21:22 ziyou11
阅读(264)
评论(0)
推荐(0)
编辑