国内最全IT社区平台 联系我们 | 收藏本站
华晨云阿里云优惠2
您当前位置:首页 > web前端 > htmlcss > IE与FF实现纯英文纯数字字符自动换行

IE与FF实现纯英文纯数字字符自动换行

来源:程序员人生   发布时间:2014-02-22 12:41:41 阅读次数:3574次

IE与FF实现纯英文纯数字字符自动换行

来源:http://www.heiniuhaha.cn/blog/?p=1112

IE css code:

#test{
width:135px;
table-layout:fixed;
word-break: break-all;
overflow:hidden;
}

FF js code:

<!Doctype html>
<html>
<body>
<div id="test" style=";border-width:1px;border-color:#333;width:400px;word-wrap:break-word;">
asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdf
777777777777777777777777777777777777777777779999999999999999990000000000000000
</div>
<SCRIPT>
function toBreakWord(intLen){
var obj=document.getElementById("test");
var strContent = obj.innerHTML;
var strTemp = "";
while(strContent.length>intLen){
strTemp += strContent.substr(0,intLen)+"<br/>";
strContent=strContent.substr(intLen,strContent.length);
}
strTemp+=strContent;
obj.innerHTML=strTemp;
}
if(document.getElementById && !document.all){toBreakWord(20);}
</SCRIPT>
</body>
</html>
生活不易,码农辛苦
如果您觉得本网站对您的学习有所帮助,可以手机扫描二维码进行捐赠
程序员人生
------分隔线----------------------------
分享到:
------分隔线----------------------------
关闭
程序员人生