代码示例:(标识:css_text-overflow2)
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="utf8" />
<link rel="stylesheet" type="text/css" href="/static/demo/html/css/cc.css" />
<script type="text/javascript" src="/static/demo/html/css/cs.js"></script>
<script type="text/javascript">
<!--
function test_demo_val(strValue)
{
var strId="MyDIV"
document.getElementById(strId).style.textOverflow=strValue;
document.getElementById("CodeValue").innerHTML=strValue;
}
//-->
</script>
<style>
#MyDIV
{
width:260px;
white-space:nowrap;
border:1px solid black;
}
#MyDIV
{
overflow:hidden;
text-overflow:clip;
}
</style>
</head>
<body>
<!--wrapper-->
<div id="wrapper">
<div id="SelArea">
<h2>CSS 属性:</h2>
<h3>text-overflow:</h3>
<form action="javascript:return false;">
<ul>
<input type="hidden" id="PreSelectedValue" value="ellipsis" />
<li><input autocomplete="off" type="radio" name="rpos" onClick="test_demo(this)" id="value_1" value="clip" />clip</li>
<li><input autocomplete="off" type="radio" name="rpos" onClick="test_demo(this)" id="value_2" value="ellipsis" />ellipsis</li>
</ul>
</form>
</div>
<div id="result">
<h2>结果:</h2>
<div id="DemoArea">
<div id="MyDIV">
这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。
这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。
</div>
</div>
<h2>CSS 代码:</h2>
<pre id="CodeArea">
#MyDIV
{
overflow:hidden;
text-overflow:<span id="CodeValue">clip</span>;
}
</pre>
</div>
</div><!--wrapper End-->
</body>
<script type="text/javascript">tiy_onload()</script>
</html>