ITeye博客

ToT

cxy020 · 共 70 篇文章

js constructor属性(2)

constructor属性始终指向创建当前对象的构造函数. 如果对 constructor的指向不是很理解,请先看 http://cxy020.iteye.com/blog/1028100 //兼容ie浏览器测试 var console = console || {}; console.log = console.log || function(a){ alert(a); } //类 function Person(obj){ obj = obj || {}; this.sex = obj.sex || 0; this.age = obj.age || 0; } //原型函数 Person.…

2014-07-31 15:38 · Javascript · 评论(0)

或运算(||),与运算(&&)

&& 和 || 运算符 ||,或运算 &&,与运算 或运算,指的是 如果 条件为真 则返回 本身,如果为假 则返回 默认值 var a = true || 1; a = true; var a = false || 1; a = 1; 如何判断条件是否为真呢,可以通过Boolean()判定; Boolean(undefined);//false; //形象一些 var a = {}; Boolean(a.b);//false; Boolean(null);//false; Boolean("");//fasle; //注意我们不能用==判断,如 undefined == false;//fa…

2014-07-17 14:46 · Javascript · 评论(0)

touchmove获取clientX

$("body").bind('touchmove', function(e){ //stops normal scrolling with touch e.preventDefault(); console.log(event.touches[0].pageX); console.log(event.touches[0].clientX); }) You are right, seems like a bug. You could hack around it by offsetting the scroll of the page (event.targetTouches[0].scre…

2014-07-10 14:05 · 随笔 · 评论(0)

js请求(2)

<html> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>js请求</title> <script src="http://code.jquery.com/jquery-1.11.1.min.js" type="text/javascript"></script> </head> <body> <input id="btn1" type="button" value="发送请求" /> </body> </html> <script type="text/javascr…

2014-07-02 12:18 · javascript学习 · 评论(0)

js请求(1)

<html> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>js请求</title> <script src="http://code.jquery.com/jquery-1.11.1.min.js" type="text/javascript"></script> </head> <body> <!-- 普通ajax请求 --> <input id="btn1" type="button" value="发送请求" /> <!-- 单例ajax请求 --> <input…

2014-07-02 11:31 · javascript学习 · 评论(0)

js事件(5)

<html> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>js事件封装</title> <script src="http://code.jquery.com/jquery-1.11.1.min.js" type="text/javascript"></script> </head> <body> <input id="btn1" type="button" value="btn1" /> <input id="btn2" type="button" value="bt…

2014-07-02 11:30 · javascript学习 · 评论(0)

js事件(4)

<html> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>jQuery事件</title> <script src="http://code.jquery.com/jquery-1.11.1.min.js" type="text/javascript"></script> </head> <body> <input id="btn1" type="button" value="btn1" /> <input id="btn2" type="button" value="…

2014-07-01 08:46 · javascript学习 · 评论(0)

js事件(3)

1<html> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>JS事件</title> <script src="http://code.jquery.com/jquery-1.11.1.min.js" type="text/javascript"></script> <style> div{ width:300px; border:1px solid blue; padding:10px; } </style> </head> <body> <!-- 事件代理 --> …

2014-07-01 08:46 · javascript学习 · 评论(0)

js事件(2)

<html> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>JS事件</title> <script src="http://code.jquery.com/jquery-1.11.1.min.js" type="text/javascript"></script> <style> </style> </head> <body> <input id="btn1" type="button" value="click1" /> <input id="btn2" type="…

2014-07-01 08:46 · javascript学习 · 评论(0)

js事件(1)

<html> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>JS事件</title> <script src="http://code.jquery.com/jquery-1.11.1.min.js" type="text/javascript"></script> <style> </style> </head> <body> <!-- 最简单的注册事件 --> <input id="btn0" type="button" value="click" onclick="…

2014-07-01 08:45 · javascript学习 · 评论(0)

html介绍(5)

<html> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>HTML动态更新</title> <script src="http://code.jquery.com/jquery-1.11.1.min.js" type="text/javascript"></script> <style> </style> </head> <body> <div id="mydiv" style="width:150px;">hello <b>Javascript</b></div> <…

2014-07-01 08:45 · javascript学习 · 评论(0)

html介绍(4)

<html> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>CSS</title> <script src="http://code.jquery.com/jquery-1.11.1.min.js" type="text/javascript"></script> <style> #mydiv{ height:80px; border:1px solid red; } .div1{ background:blue; } .div2{ padding:20px; } .di…

2014-06-30 09:02 · javascript学习 · 评论(0)

html介绍(3)

<html> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>HTML标签</title> <script src="http://code.jquery.com/jquery-1.11.1.min.js" type="text/javascript"></script> </head> <body> <!-- 下拉框 --> <select id="myselect"> <option value="1" >A</option> <option value="2" >B<…

2014-06-30 09:02 · javascript学习 · 评论(0)

html介绍(2)

<html> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>HTML标签</title> <script src="http://code.jquery.com/jquery-1.11.1.min.js" type="text/javascript"></script> </head> <body> <!-- 一组单选框 --> <label for="A">A</label><input id="A" name="letter1" value="1" type="rad…

2014-06-30 09:01 · javascript学习 · 评论(0)

html介绍(1)

<html> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>HTML标签</title> </head> <body> <!-- 输入框 --> <input id="mytxt" type="text" /><br /> <!-- 密码框 --> <input id="mypwd" type="password" placeholder="hello..." /><br /> <input id="mybtn" type="button" value="click" /…

2014-06-30 09:00 · javascript学习 · 评论(0)