<script> djConfig = {parSEOnLoad: true,isDebug:true,debugAtAllCosts:true} </script> <script type="text/javascript" src="../../libs/dojo/dojo.js"></script> <script type="text/javascript"> console.debug("dojo version :"+dojo.version); dojo.require("dojo.string"); dojo.require("dojo.parser"); dojo.addOnLoad(function(){ var i = 5; var arg = 0; var foo = dojo.byId("domNo") console.debug("dojo version :"+dojo.string.pad("",i)); console.debug("dojo version :"+dojo.string.pad("",i," - ")); console.debug("dojo version :"+dojo.string.pad("-"," - ")); foo.innerHTML = dojo.byId("div1").innerHTML+dojo.string.pad("",i) +"<br/>长度五个算空格补-"+dojo.string.pad(""," - ") +"<br/>长度五个算空格补-"+dojo.string.pad("-"," - ") +"<br/>长度五个算空格补-:" +dojo.string.pad("arg"," - ") +"<br/>长度五个算空格补-:"+dojo.string.pad(arg," - ",true); var str = dojo.string.substitute("${0} and ${1}",["AAAAA","22222222222"]); console.debug("字符 :"+str); str = dojo.string.substitute("${person1} and ${person2}",{person1:" Jack 1 ",person2:" Jack 1 22"}); console.debug("字符 :"+str); str = dojo.string.substitute("/n${person1} /nand/n ${person2}",person2:" Jack 1 22 "},function(x){return "888"+x+"888/n"} ); console.debug("字符 :"+str); console.debug("字符替换空格 :"+dojo.string.trim(str)); dojo.byId("div1").innerHTML = dojo.string.trim(str); }); </script> </HEAD> <BODY class="tundra"> <div class="div" id="div1" link="1###" style="width:736px;margin:0 auto;"> <h2>字符测试</h2> </div> <div id="domNo"> </div>