http://code.google.com/p/modalbox/issues/detail?id=360 写道
?
http://code.google.com/p/modalbox/
?
1. this.focusableElements is undefined modalbox.js Line 438 <code> _putContent: function(callback){ this.MBcontent.show(); this.focusableElements = this._findFocusableElements(); this._setFocus(); // Setting focus on first 'focusable' element in content (input, select, textarea, link or button) if(callback != undefined) callback(); // Executing internal JS from loaded content this.event("afterLoad"); // Passing callback }, </code> this.focusableElements = this._findFocusableElements(); have a problem <code> _findFocusableElements: function() { // Collect form elements or links from MB content if (this.options.autoFocusing === true) { // TODO maybe add :enabled to select and textarea elements this.MBcontent.select('input:not([type=hidden]):enabled, select, textarea, button, a[href]').invoke('addClassName', 'MB_focusable'); this.focusableElements = this.MBcontent.select('.MB_focusable'); } }, <code> if this.options.autoFocusing == false , will not return value I add line "return this.focusableElements ;" or modify _putContent function line: this.focusableElements = this._findFocusableElements(); modify this._findFocusableElements();?
1 楼
vb2005xu
2010-12-07
编写Web前端代码的注意事项
1. 最好在html标签之前添加一句类似于
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd" >
的代码,该代码表示遵循W3C的某一套标准,具体使用哪套标准因人而异。
使用该标准的好处是不用再为各种不同浏览器环境下网站的布局不一样的问题而烦恼。使用该标准后,笔者在IE8、FF、Safari浏览器环境下测试,结果页面显示均正常。另外,发现使用该标准后包括一些IE本身的bug也不再出现,如IE默认div框的高度要大于字体高度的bug,在遵循该标准后就不再出现。
在遵循该标准后需要注意的一点是,有些写的不规范的代码可能就不能正常工作。例如在javascript中有 roll1right.innerHTML = roll1left.innerHTML;的代码,其中roll1right和roll1left是网页上两个不同div的id,在没有套用该标准的情况下网页可以工作,但在W3C标准下该语句就出现bug。原因是W3C要求所有的变量都有明确的赋值,因此必须在该语句之前加上var roll1right = document.getElementById("roll1right");的语句,随后代码全部正常工作。
2. 在网页中使用div和table时,发现:虽然同样可以通过css设置div和table的border、margin、padding都为 0,但是div显示正常的同时,table仍然会有一定的空隙。查询了W3CSchool后发现,原来table有cellpadding和 cellspacing两个属性,其中cellpadding属性规定单元边沿与内容之间的空白,而cellspacing属性规定了单元之间的空白。于是将网页中的table的cellpadding和cellspacing两个属性都设为0,果然网页的table不再有空隙,问题解决。
1. 最好在html标签之前添加一句类似于
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd" >
的代码,该代码表示遵循W3C的某一套标准,具体使用哪套标准因人而异。
使用该标准的好处是不用再为各种不同浏览器环境下网站的布局不一样的问题而烦恼。使用该标准后,笔者在IE8、FF、Safari浏览器环境下测试,结果页面显示均正常。另外,发现使用该标准后包括一些IE本身的bug也不再出现,如IE默认div框的高度要大于字体高度的bug,在遵循该标准后就不再出现。
在遵循该标准后需要注意的一点是,有些写的不规范的代码可能就不能正常工作。例如在javascript中有 roll1right.innerHTML = roll1left.innerHTML;的代码,其中roll1right和roll1left是网页上两个不同div的id,在没有套用该标准的情况下网页可以工作,但在W3C标准下该语句就出现bug。原因是W3C要求所有的变量都有明确的赋值,因此必须在该语句之前加上var roll1right = document.getElementById("roll1right");的语句,随后代码全部正常工作。
2. 在网页中使用div和table时,发现:虽然同样可以通过css设置div和table的border、margin、padding都为 0,但是div显示正常的同时,table仍然会有一定的空隙。查询了W3CSchool后发现,原来table有cellpadding和 cellspacing两个属性,其中cellpadding属性规定单元边沿与内容之间的空白,而cellspacing属性规定了单元之间的空白。于是将网页中的table的cellpadding和cellspacing两个属性都设为0,果然网页的table不再有空隙,问题解决。