dojo的一些常用知识

前端之家收集整理的这篇文章主要介绍了dojo的一些常用知识前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
1、添加css dojo.addClass(dojo.byId("printsportscore"),"choosedItem"); 2、得到某月的天数 var temp=new Date("2012,5,1"); alert(dojo.date.getDaysInMonth(temp)); var dateStr = dojo.date.locale.format(tempDate,{datePattern:"yyyy-MM-dd ",timePattern:"HH:mm:ss",selector:"datetime"});//2012-05-24 15:30:30 3、Dojo输入检验例子 http://blog.csdn.net/dojotoolkit/article/details/7598226 http://dojotoolkit.org/documentation/tutorials/1.7/validation/demo/dijitcheck.html 4、为Dom节点绑定OnClick事件用click,设置节点属性 dojo.connect(td,"click",this,this.requestDutyRecordById); dojo.attr(td,"id",tdId+"_"+item["id"]); 5、格式化字符串 var tdId = dojo.string.substitute("td_${0}_${1}_${2}",[item["mrUserId"],dayInMonth + 2,dateStr]); 6、日期比较 dojo.date.compare(recordDate,null,"date"),return -1,1 dojo.date.difference(recordDate,"day"),return integer 7、dojo创建Dom节点 dojo.create("a",{ href: "foo.html",title: "Goto FOO!",innerHTML: "link" },dojo.body()); dojo.create("td",{innerHTML:"呼救电话",classname:"answerTimeTh"},th);//添加样式用classname,用class,IE会报错:缺少标识符、字符串或数字 http://dojotoolkit.org/reference-guide/1.7/dojo/create.html 8、dojo获得Dom节点 dojo.query("#divDispatchCount>span"); dojo.query("#divDispatchCount") http://hi.baidu.com/lee_geoffrey/blog/item/380120fd64cc62a2b801a042.html 9、js ReplaceAll 替换所有字符 var str="2012-06-01 00:00:00"; str.replace("-",",");//"2012,06-01 00:00:00" 方案一{ String.prototype.replaceAll = function(s1,s2){ return this.replace(new RegExp(s1,"gm"),s2); }; str.replaceAll("-",06,01 00:00:00" } 方案二{ str.replace(/-/g,',');//"2012,01 00:00:00" } 10、往表格中添加tr //dojo.byId(this.pageElements.tbDutyRecordsId).firstChild.appendChild(tr); var statusGTSNode = document.getElementById("tr0001"); // statusGTSNode.parentNode.insertBefore(trMid,statusGTSNode); statusGTSNode.parentNode.appendChild(tr); 11、删除表格的所有行 var trs=table.rows; for(var idx=trs.length-1;idx>=0;idx--){ table.deleteRow(idx); } 12、enhancedGrid不能放在Dialog里面,会报"堆栈溢出"错误。 13、IE中enhancedGrid首行的全选框不显示 dojox/grid/enhanced/nls/zh/EnhancedGrid.js中的属性selectAll:"全部选中"改为:selectAll:""。 dojo生成的Html是 <div aria-label="全部选中" tabindex="-1" id="aidMeasureGrid_rowSelector_-1" class="dojoxGridRowSelector dijitReset dijitInline dijitCheckBox" role="presentation" aria-pressed="false"><span class=" dojoxGridRowSelectorStatusText"></span><span style="height: 0; width: 0; overflow: hidden; display: block;"></span></div> IE强制换行后,用于全选的checkBox就看不到了,去掉那些文字就行了。 14、enhancedGrid indrectSelection 全选 dijit.byId("grid").rowSelectCell.toggleAllSelection(true); 15、enhancedGrid pagination IE中报错stack over at line 0 http://bugs.dojotoolkit.org/ticket/14732 16、dojo动画效果 http://www.chineselinuxuniversity.net/articles/28381.shtml 17、dojo Cookie http://dojotoolkit.org/reference-guide/1.7/dojo/cookie.html

猜你在找的Dojo相关文章