javascript

jQuery 2.0正式发布,抛弃 IE6/7/8 兼容,更小更快

Posted by bower on April 21, 2013
cross browser, javascript / No Comments

分享给你的朋友->bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

下面是 2.0 版本的一些特性:
1、不兼容 IE6/7/8
需要注意 IE9、IE10 的兼容模式仍然会使 jQuery 2.0 运行不正常,需要在 HTTP header 指定X-UA-Compatible 属性,或者在页面 meta 标签中声明(性能原因,不推荐后者);

Continue reading…

“该网页已对该表单停用自动填充功能”提示 autocomplete=”off” 引起

Posted by bower on April 01, 2012
cross browser, javascript / No Comments

分享给你的朋友->bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

 

有图有真相

Continue reading…

IE6 IE7 IE8 在 position : relative 时fadeIn() fadeOut() bug 解决方案

Posted by bower on April 01, 2012
cross browser, javascript / 1 Comment

分享给你的朋友->bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

先看一个例子

<div class="fadein">
    <div>
        <div>I am going to fade in ;</div>
        <div>I am going to fade in ;</div>
    </div>
</div>
$('.fadein').fadeIn();

Continue reading…

新浪微博 分享到 功能 缓存 bug

Posted by bower on February 10, 2012
javascript / No Comments

分享给你的朋友->bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

现在一键分享到微博功能 成了很多网站的标配 昨天遇到一个问题

http://service.t.sina.com.cn/share/share.php?title=ttt&url=http://qiongbupa.com

Continue reading…

Tags: , , ,

由href return false 来看阻止默认事件

Posted by bower on February 09, 2012
javascript / 1 Comment

分享给你的朋友->bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

很多时候我们都想阻止一个a  link的href跳转,

<a onclick=”return false;” href=”www.360.cn”>click</a>

Continue reading…

Tags: ,

寿星万年历 元旦不显示 bug修改

Posted by bower on December 23, 2011
javascript / No Comments

分享给你的朋友->bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

首先感谢寿星万年历的作者许剑伟同志对开源软件的贡献 让我受益匪浅

Continue reading…

javascript事件冒泡与事件捕获

Posted by bower on November 15, 2011
javascript / No Comments

分享给你的朋友->bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

javascript的核心就在于事件处理。我们经常会对一个对象进行事件绑定,加上事件处理函数。如果一个元素和它的一个上级节点对于同一个事件都有进行事件处理,哪一个先触发呢?毫无疑问,这决定于浏览器。

Continue reading…

javascript var 声明:用var 声明的变量是不能被删除的。

Posted by bower on October 05, 2011
javascript / No Comments

分享给你的朋友->bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

We see that at this phase there is no any “b” since it is not a variable, “b” will appear only at code execution phase (but in our case won’t since there is an error).

Continue reading…

javascript 随机取值 确定范围内的整数

Posted by bower on October 05, 2011
javascript / No Comments

分享给你的朋友->bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

if(!Math.prototype.randomFromTo){
       Math.prototype.randomFromTo = function(from, to){
           return Math.floor(Math.random() * (to - from + 1) + from);
      };
}

Continue reading…

javascript NaN

Posted by bower on September 25, 2011
javascript / No Comments

分享给你的朋友->bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

javascript 中有一个值NaN 它是一个怪胎

NaN 的意思是 Not a Number

但是 typeof NaN  // number 也就是说 NaN是数字类型的 ecma的文档里确实这么写的

Continue reading…

javascript 内部属性[[Class]]

Posted by bower on September 22, 2011
javascript / 1 Comment

分享给你的朋友->bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

jvascript object 内部属性, 每一个对象都有这些内部属性

Internal Property Value Type Domain Description
[[Prototype]] Object or Null The prototype of this object.
[[Class]] String A String value indicating a specification defined classification of objects.
[[Extensible]] Boolean If true, own properties may be added to the object.
[[Get]] SpecOp(propertyName) →
any
Returns the value of the named property.
[[GetOwnProperty]] SpecOp (propertyName) → Undefined orProperty Descriptor Returns the Property Descriptor of the named own property of this object, orundefined if absent.
[[GetProperty]] SpecOp (propertyName) → Undefined or Property Descriptor Returns the fully populated Property Descriptor of the named property of this object, or undefined if absent.
[[Put]] SpecOp (propertyName, any, Boolean) Sets the specified named property to the value of the second parameter. The flag controls failure handling.
[[CanPut]] SpecOp (propertyName) → Boolean Returns a Boolean value indicating whether a [[Put]] operation withpropertyName can be performed.
[[HasProperty]] SpecOp (propertyName → Boolean) Returns a Boolean value indicating whether the object already has a property with the given name.
[[Delete]] SpecOp (propertyName, Boolean) → Boolean Removes the specified named own property from the object. The flag controls failure handling.
[[DefaultValue]] SpecOp (Hint) → primitive Hint is a String. Returns a default value for the object.
[[DefineOwnProperty]] SpecOp (propertyName, PropertyDescriptor, Boolean) → Boolean Creates or alters the named own property to have the state described by a Property Descriptor. The flag controls failure handling.

Continue reading…

Doctype 与 浏览器显示模式

Posted by bower on August 26, 2011
cross browser, javascript / No Comments

分享给你的朋友->bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

 

Doctype NS6 Old
Moz
Moz &
Safari &
Opera 10
& HTML5
Opera 9.0 IE 8, IE 9 & Opera 9.5 IE 7 & Opera
7.10
IE
6
& Opera 7.0
Mac
IE 5
Konq
3.2
None Q Q Q Q Q Q Q Q Q
<!DOCTYPE
HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
Q Q Q Q Q Q Q Q Q
<!DOCTYPE
HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
S S S S S A A A A
<!DOCTYPE
HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
S S S S S A A Q A
<!DOCTYPE
HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
"http://www.w3.org/TR/html4/strict.dtd">
S S S S S A A A A
<!DOCTYPE
HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
S S S S S A A A A
<!DOCTYPE
HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
Q Q Q Q Q Q Q Q Q
<!DOCTYPE
HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
Q Q Q Q Q Q Q Q Q
<!DOCTYPE
HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
S S A A A A A A Q
<!DOCTYPE
HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
Q S A A A A A A Q
<!DOCTYPE
HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
Q Q Q Q A A A A Q
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> S S S S S A A A A
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd"> S S S S S A A A A
<!DOCTYPE
html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
S S S S S A A A A
<!DOCTYPE
html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
S S A A A A A A Q
<?xml
version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.1//EN” “http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd”>
S S S S S A Q A Q
<?xml
version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML Basic 1.0//EN” “http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd”>
S S S S S A Q A Q
<?xml
version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
S S S S S A Q A Q
<?xml
version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
S S A A A A Q A Q
<!DOCTYPE
HTML PUBLIC "ISO/IEC 15445:2000//DTD HTML//EN">
Q S S Q Q Q Q Q Q
<!DOCTYPE
HTML PUBLIC "ISO/IEC 15445:2000//DTD HyperText Markup
Language//EN">
Q S S S S A A A Q
<!DOCTYPE
HTML PUBLIC "ISO/IEC 15445:1999//DTD HTML//EN">
S S S Q Q Q Q Q Q
<!DOCTYPE
HTML PUBLIC "ISO/IEC 15445:1999//DTD HyperText Markup
Language//EN">
S S S S S A A A Q
<!DOCTYPE html> Q S S S S A A A

Continue reading…

回到顶部 jquery解决办法

Posted by bower on August 22, 2011
javascript / No Comments

分享给你的朋友->bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark


$(function() {
$.fn.scrollToTop = function() {
$(this).hide().removeAttr(“href”);
if ($(window).scrollTop() != “0”) {
$(this).fadeIn(“slow”)
}
var scrollDiv = $(this);
$(window).scroll(function() {
if ($(window).scrollTop() == “0”) {
$(scrollDiv).fadeOut(“slow”)
} else {
$(scrollDiv).fadeIn(“slow”)
}
});
$(this).click(function() {
$(“html, body”).animate({
scrollTop: 0
}, “slow”)
})
}
});
$(function() {
$(“#w2b-StoTop”).scrollToTop();
});

回到顶部 滚动到顶部 jquery 实现方法

Posted by bower on August 18, 2011
javascript / No Comments

分享给你的朋友->bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

 $('html, body').animate({ scrollTop: 0 }, 0);

Continue reading…

tangram baidu 百度js库tangram开源 叫七巧板。。

Posted by bower on December 23, 2010
cross browser, javascript, / 1 Comment

分享给你的朋友->bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

http://tangram.baidu.com/tangram/index.html

tangram baidu  百度js库tangram开源 叫七巧板。。

全世界最短的IE判定Javascript代码

Posted by bower on October 08, 2010
javascript / No Comments

分享给你的朋友->bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

以前最短的IE判定基于IE不支持垂直制表符的特性。
var ie = !+"\v1";

Continue reading…

Tags:

jquery ajax callback context changed

Posted by bower on September 22, 2010
javascript / No Comments

分享给你的朋友->bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

the context in ajax call back is not the same one I pass in to it, at lease in IE its not, I think it just been cloned
since I got the problem in IE, and I debug it for 2 hours and find the problem.

Continue reading…

Tags:

jquery bind 改变context this指向

Posted by bower on September 18, 2010
javascript, / No Comments

分享给你的朋友->bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

myObject = function(){
this.clicked = false;

}
myObject.prototype.click = function(e){
this.clicked = true;
var dom = e.target
}
var myOinstance = new myObject()
$('#myid').bind('click',myOinstance.click);

以上代码OO思想意图不会被实现 ,因为myOinstance.click中的this指向$(‘#myid’)的dom元素,而不是myOinstance
很可惜目前jquery不提供更改this指向或改变context的bind方法,我们要自己做一个扩展。

Continue reading…

Tags:

html5 互动电影

Posted by bower on September 07, 2010
cross browser, javascript / No Comments

分享给你的朋友->bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

http://www.thewildernessdowntown.com/

一个人。。。

Javascript unpacker and beautifier 反编译

Posted by bower on September 05, 2010
javascript / No Comments

分享给你的朋友->bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

http://jsbeautifier.org/

Javascript unpacker and beautifier 反编译,有空可以试试

Google 互联网开发技术交流会:下一代 Web 标准和浏览器发展趋势

Posted by bower on September 01, 2010
cross browser, javascript / No Comments

分享给你的朋友->bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

会议日程

日期:2010 年 9 月 2 日(周四)

Continue reading…

Tags:

javascript实例共享受继承于同一个实例

Posted by bower on June 23, 2010
javascript / No Comments

分享给你的朋友->bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

pp= function(){

this.foo=[1,2,3];

}

pp.prototype.dothefoo = function(){

this.foo.pop();

}

Continue reading…

jQuery: Understanding the “chain”

Posted by bower on March 16, 2010
javascript / No Comments

分享给你的朋友->bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

jQuery: Understanding the “chain”
Categories: Source Code, JavaScript, jQuery

Yesterday I was writing some jQuery code and I thought I came across a bug—until I realized it was a bug in my way of thinking and not with jQuery.

Continue reading…

Tags: ,

IE6/IE7 0day 漏洞 加测试链接

Posted by bower on November 24, 2009
cross browser, javascript, living on earth / No Comments

分享给你的朋友->bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

昨天(2009年11月21日),Symantec发布了IE的一个0day安全漏洞的消息。关于这个消息,截止本文发布时,在中文社区里还没有报导。这是一个关于IE6/IE7处理CSS时的一个漏洞(关于IE和CSS的BUG)。如果你目前还在使用IE6/IE7,那你现在可能是你升级的时候了,当然,有很多人说IE8是没有问题的,但我个人还是建议在补丁出来之前先使用Firefox或Chrome。

Continue reading…

Tags: ,

javascript 控制 改变 float属性

Posted by bower on October 16, 2009
javascript / No Comments

分享给你的朋友->bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

style.float是不行的

其实很简单:

$(‘contentDiv’).style.cssFloat = ‘right’;
$(‘contentDiv’).style.styleFloat = ‘right’;// IE6

ie6 css display inline-block 解决方法

Posted by bower on September 15, 2009
cross browser, javascript / No Comments

分享给你的朋友->bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

ie6 css display属性是不支持inline-block的

display:-moz-inline-stack;
display:inline-block;
zoom:1;
*display:inline;

Continue reading…

script 标签 onerror事件,script tag onerror

Posted by bower on July 30, 2009
cross browser, javascript / No Comments

分享给你的朋友->bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

<script onerror=”getfail()” scr=”test.js”></script>

如果test.js不存在,或无法加载,会触发getfail函数, 目前只有firefox支持

Continue reading…

javascript bookmark 添加书签到 firefox IE opera safari 适于大部分浏览器

Posted by bower on July 27, 2009
cross browser, javascript / No Comments

分享给你的朋友->bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

<script type=”text/javascript”>// <![CDATA[
function addBookmark( o) {
var url = o.href;
var title = o.title;
var isSafari = navigator.userAgent.toLowerCase().indexOf(‘webkit’)!=-1;
if(document.all){ //IE
window.external.AddFavorite(url, title);
} else if(isSafari){
alert(‘please press ctrl + D to bookmark’);//只有safari不能用javascript添加
o.href=”#bookmark”;
}
}
// ]]></script><a title=”bowerpower” onclick=”addBookmark(this);” rel=”sidebar” href=” http://www.bowerpower.cn “>收藏此链接</a>

Continue reading…

做一个取经纬度的google地图 get geo from google map

Posted by bower on July 22, 2009
javascript / No Comments

分享给你的朋友->bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

做一个取经纬度的google地图 get geo from google map
http://www.bowerpower.cn/googlemap/geo.html

Continue reading…

make mapsite for google

Posted by bower on July 08, 2009
javascript / No Comments

分享给你的朋友->bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

http://www.xml-sitemaps.com/

可以在线做sitemap

Tags: