dom积累

摘要: dom document object model 文档对象模型1、事件 body 事件 onload onunload onbeforeunload 常见事件 onclick(单击)、ondblclick(双击)、onkeydown(按键按下)、onkeypress(点击按键)、onkeyup(按键释放)、onmousedown(鼠标按下)、onmousemove(鼠标移动)、onmouseout(鼠标离开元素范围)、onmouseover(鼠标移动到元素范围)、onmouseup(鼠标按键释放2、动态设置事件 类似于net中注册事件 document.ondbclick = f1; //让 阅读全文
posted @ 2013-03-21 22:12 平小 阅读(120) 评论(0) 推荐(0)

简单的正则表达式

摘要: var reg = /^[0-9a-zA-Z]{6,16}$/;//6-16个英文或数字QQ:[1-9]\d{5,11}身份证:\d{17}[\d|X] 阅读全文
posted @ 2013-03-21 22:11 平小 阅读(135) 评论(0) 推荐(0)

通过GET方式进行Ajax操作;

摘要: var xhr; window.onload = function () { xhr = createXmlHttp(); } function doAjax() { xhr.open("GET", "Ajax.aspx?isAjax=1", true); xhr.onreadystatechange = watching; xhr.send(null); } function watching() { if (xhr.readyState==4) { if (xhr.status == 200) { var txt = xhr.responseText 阅读全文
posted @ 2013-03-21 22:10 平小 阅读(148) 评论(0) 推荐(0)

创建xhr对象实现浏览器全兼容

摘要: function createXmlHttp() {//创建xhr对象 var xhobj = false; try { xhobj = new ActiveXObject("Msxml2.XMLHTTP"); // ie msxml3.0+ } catch (e) { try { xhobj = new ActiveXObject("Microsoft.XMLHTTP"); //ie msxml2.6 } catch (e2) { xhobj = false; } } if (!xhobj && typeof XMLHttpReques 阅读全文
posted @ 2013-03-21 22:09 平小 阅读(220) 评论(0) 推荐(0)