随笔分类 -  js/jq

上一页 1 ··· 3 4 5 6 7 8 9 10 下一页
摘要:1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html;ch 阅读全文
posted @ 2012-06-04 16:43 小猩猩君 阅读(179) 评论(0) 推荐(0)
摘要:1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html;ch 阅读全文
posted @ 2012-06-04 15:34 小猩猩君 阅读(159) 评论(0) 推荐(0)
摘要:1 //getClipboardText2 EventUtil.addHandler(textbox, "paste", function(event) {3 event = EventUtil.getEvent(event);4 var text = EventUtil.getClipboardText(event);5 6 if (!/^\d*$/.test(text)) {7 EventUtil.preventDefault(event);8 }9 }); 阅读全文
posted @ 2012-06-04 11:42 小猩猩君 阅读(339) 评论(0) 推荐(0)
摘要:1 var textbox = document.forms[0].elements["textbox1"]; 2 3 //文本框忽略所有输入的非数值 4 EventUtil.addHandler(textbox, "keypress", function(event) { 5 event = EventUtil.getEvent(event); 6 var target = EventUtil.getTarget(event); 7 var charCode = EventUtil.getCharCode(event); 8 9 if (!/\d/.t 阅读全文
posted @ 2012-06-03 23:10 小猩猩君 阅读(230) 评论(0) 推荐(0)
摘要:1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html;ch 阅读全文
posted @ 2012-06-03 17:01 小猩猩君 阅读(220) 评论(0) 推荐(0)
摘要:1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html;ch 阅读全文
posted @ 2012-06-03 15:44 小猩猩君 阅读(4037) 评论(0) 推荐(0)
摘要:1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html;ch 阅读全文
posted @ 2012-06-03 12:45 小猩猩君 阅读(185) 评论(0) 推荐(0)
摘要:1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html;ch 阅读全文
posted @ 2012-06-01 15:07 小猩猩君 阅读(1334) 评论(0) 推荐(0)
摘要:DOM 1 var btn = document.getElementById("myBtn"); 2 3 //创建事件对象 4 var event = document.createEvent("MouseEvents"); 5 6 //初始化事件对象 7 event.initMouseEvent("click", true, true, document.defaultView, 0, 0, 0, 0, 0, false, false, false, false, 0, null); 8 9 //触发事件10 btn.dispat 阅读全文
posted @ 2012-06-01 10:53 小猩猩君 阅读(172) 评论(0) 推荐(0)
摘要:1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html;ch 阅读全文
posted @ 2012-05-31 21:13 小猩猩君 阅读(196) 评论(0) 推荐(0)
摘要:1 (function() { 2 function handleMouseWheel(event) { 3 event = EventUtil.getEvent(event); 4 var delta = EventUtil.getWheelDelta(event); 5 console.log(delta); 6 } 7 8 EventUtil.addHandler(document, "mousewheel", handleMouseWheel); 9 EventUtil.addHandler(docum... 阅读全文
posted @ 2012-05-31 16:57 小猩猩君 阅读(1136) 评论(0) 推荐(0)
摘要:1 var a = [];2 alert(a.constructor == Array); 阅读全文
posted @ 2012-05-31 16:31 小猩猩君 阅读(160) 评论(0) 推荐(0)
摘要:1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html;ch 阅读全文
posted @ 2012-05-31 16:23 小猩猩君 阅读(1603) 评论(0) 推荐(0)
摘要:1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html;ch 阅读全文
posted @ 2012-05-31 14:29 小猩猩君 阅读(636) 评论(0) 推荐(0)
摘要:1 var isSupported = document.implementation.hasFeature("HTMLEvents","2.0"); 阅读全文
posted @ 2012-05-29 15:50 小猩猩君 阅读(172) 评论(0) 推荐(0)
摘要:1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html;ch 阅读全文
posted @ 2012-05-28 17:03 小猩猩君 阅读(505) 评论(0) 推荐(0)
摘要:1 var link = document.getElementById("myLink"); 2 //only IE 3 link.onclick = function() { 4 window.event.returnValue = false; 5 }; 6 7 //DOM0 8 link.onclick = function(event) { 9 event.preventDefault();10 };11 12 //DOM事件监听13 link.addEventListener("click", function(event) {14 even 阅读全文
posted @ 2012-05-28 10:17 小猩猩君 阅读(144) 评论(0) 推荐(0)
摘要:1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html;ch 阅读全文
posted @ 2012-05-26 17:26 小猩猩君 阅读(2375) 评论(0) 推荐(0)
摘要:1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html;ch 阅读全文
posted @ 2012-05-25 21:46 小猩猩君 阅读(228) 评论(0) 推荐(0)
摘要:1 function t(s, data){ 2 var r = [], i = 0, len = data.length; 3 for(; i < len; i++){ 4 r.push(s.replace(/\$[\w\d]+/g, function(m){ 5 return (m = m.substr(1)) in data[i] ? data[i][m] : ''; 6 })) 7 } 8 return r.join('\r\n'); 9 }10 11 console.log(t('<li>$na... 阅读全文
posted @ 2012-05-25 15:35 小猩猩君 阅读(156) 评论(0) 推荐(0)

上一页 1 ··· 3 4 5 6 7 8 9 10 下一页