Posted in 2010/03/10 ¬ 16:39h.阿飞
当checkbox的indeterminate设置为true的时候, input会变成灰色打勾的状态. IE一直支持此属性, 而Firefox却不支持.不过在最新的Firefox3.6中, 也开始支持这个属性了. 我们可以用简单的javascript来实现三态checkbox. $("input:checkbox").live("click",function() { if(this.getAttribute("checked") && !this.getAttribute("indeterminate")) { this.setAttribute("indeterminate", true); this.setAttribute("indeterminate-status", true); return false; } else if(!this.getAttribute("indeterminate") && this.getAttribute("indeterminate-status")) { this.setAttribute("checked", true); this.removeAttribute("indeterminate-status"); return true; } });
Read the rest of this entry »
Posted in 2009/07/28 ¬ 14:13h.阿飞
使用JavaScript获取input光标,这里只介绍常用的IE和Firefox中的方法: 在Firefox中非常简单,在IE中非常强大,两种不同的获取方式如下: function GetPosition(input) { if($.browser.msie) { var cuRange=document.selection.createRange(); var tbRange=input.createTextRange(); tbRange.collapse(true); tbRange.select(); var headRange=document.selection.createRange(); headRange.setEndPoint("EndToEnd",cuRange); var pos=headRange.text.length; cuRange.select(); return pos; } else return input.selectionStart; }
Read the rest of this entry »
Posted in 2009/07/01 ¬ 23:41h.阿飞
在<embed>标签中加上 allowScriptAccess=”always” 这一属性即可 <embed allowScriptAccess="always"… />
Read the rest of this entry »