兼容火狐的文字边界自动换行
2009-01-13 11:50
260 查看
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh" lang="zh">
<head profile="http://www.w3.org/2000/08/w3c-synd/#">
<meta http-equiv="content-language" content="zh-cn" />
<meta http-equiv="content-type" content="text/html;charset=gb2312" />
<title>blueidea</title>
<style type="text/css">
/*<![CDATA[*/
div {
width:300px;
word-wrap:break-word;
border:1px solid red;
}
/*]]>*/
</style>
</head>
<body>
<div id="ff">aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</div>
<script type="text/javascript">
// <![CDATA[
function toBreakWord(intLen){
var obj=document.getElementById("ff");
var strContent=obj.innerHTML;
var strTemp="";
while(strContent.length>intLen){
strTemp+=strContent.substr(0,intLen)+" ";
strContent=strContent.substr(intLen,strContent.length);
}
strTemp+=" "+strContent;
obj.innerHTML=strTemp;
}
if(document.getElementById && !document.all) toBreakWord(37)
// ]]>
</script>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh" lang="zh">
<head profile="http://www.w3.org/2000/08/w3c-synd/#">
<meta http-equiv="content-language" content="zh-cn" />
<meta http-equiv="content-type" content="text/html;charset=gb2312" />
<title>blueidea</title>
<style type="text/css">
/*<![CDATA[*/
div {
width:300px;
word-wrap:break-word;
border:1px solid red;
}
/*]]>*/
</style>
</head>
<body>
<div id="ff">aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</div>
<script type="text/javascript">
// <![CDATA[
function toBreakWord(intLen){
var obj=document.getElementById("ff");
var strContent=obj.innerHTML;
var strTemp="";
while(strContent.length>intLen){
strTemp+=strContent.substr(0,intLen)+" ";
strContent=strContent.substr(intLen,strContent.length);
}
strTemp+=" "+strContent;
obj.innerHTML=strTemp;
}
if(document.getElementById && !document.all) toBreakWord(37)
// ]]>
</script>
</body>
</html>
相关文章推荐
- CSS实现文字自动换行(兼容IE和火狐)
- 英文自动换行,兼容火狐和IE
- CSS实现文字自动换行(兼容Firefox)
- CSS实现文字自动换行(兼容Firefox)
- 火狐下文字自动换行
- html 图片超出父容器,文字超出边界需要自动换行处理方法
- #CSS#在设定table为百分比时,如何实现火狐,Chrome下TD内容文字超出时自动换行?
- 文字在边界自动换行word-wrap:break-word
- 两个很有用的eclipse插件(兼容win与ubuntu):文字自动换行插件和打开目录
- Android TextView自动换行文字排版参差不齐的原因
- div css背景颜色半透明 文字不透明兼容ie、火狐等浏览器
- 重写java中JButton,实现图片下显示文字(根据图片宽度文字自动换行)
- HTML select处理文字超出宽度自动换行的问题
- css实现页面文字不换行、自动换行、强制换行
- iOS开发之UIlabel多行文字自动换行 (自动折行)
- 关于div设置最小高度,超过后自动增加的css,兼容IE和火狐
- GridView自动生成列时,利用DIV控制显示长宽 控件数据行和表头文字不换行
- 文字+图片无缝滚动 兼容ie 360 火狐 谷歌 [花20积分买的]
- iOS开发之UIlabel多行文字自动换行 (自动折行)
- css处理过长文字自动隐藏(兼容IE和firefox)