- 5
- 0
- 约4.96千字
- 约 20页
- 2017-06-05 发布于河南
- 举报
文本溢出的用省略号表示(国外英文资料)
文本溢出的用省略号表示
在JavaScript中写入:
脚本语言= JavaScript
函数initMozTextOverflow(obj)
{
re_render()函数
{
doMozTextOverflow(obj);
}
setTimeout(re_render,0);
}
函数doMozTextOverflow(obj)
{
函数_overflow(e)
{
var el = e.currentTarget;
el.className = _textOverflow”;
}
函数_underflow(e)
{
var el = e.currentTarget;
el.className = _textUnderflow”;
}
obj.className = _textUnderflow”;
obj。addEventListener(_overflow,“溢出”错误);
obj。addEventListener(“_underflow下溢”,假);
obj。ins = document.createElement(ins);
obj.ins.innerHTML = …;
obj.appendChild(obj.ins);
obj。onmousedown = function(e)
{
这一点。selectStartX = e。clientX document.getBoxObjectFor(这)方式;
}
obj。onmouseup = function(e)
{
这一点。selectStartX =零;
}
obj。onmousemove = function(e)
{
如果(this.selectStartX != null)
{
var mx = e。clientX - this.selectStartX;
var =交货。offsetWidth - this.selectStartX;
if((前-mx)小于(this.ins.offsetwidth+3))
{
如果(this.className ! =“_textUnderflow”)
{
this.className = _textUnderflow”;
this.scrollLeft = 0;
var盒= document.createElement(“输入”);
box.setAttribute(“类型”、“文本”);
box.value = 1111
this.appendChild(盒);
box.select();
this.removeChild(盒);
this.focus();
}
}
其他的
{
如果(this.className ! =“_textOverflow”)
{
this.className = _textOverflow
}
}
返回错误;
}
};
}
/脚本
时尚
身体{
字体类型:Verdana;
}
p {
颜色:# FF0099;
字体大小:0.78 em;
利润:0.5 em;
}
* / / *示例1
.textOverflow {
宽度:50%;
边界:固体1 px # 222222;
}
。textOverflow div
{
高度:1.5 em;
位置:相对;
字体大小:0.78 em;
宽度:95%;
边界底部:固体1 px # aaaaaa;
填充:2 px;空白:nowrap;}
溢出:隐藏;
保证金:2 px 0;
文本溢出:省略;
-mozilla绑定:url(“mozilla-文本溢出。xml xbldocument”);/可扩展的用于Firefox的语言
}
。textOverflow div ins {
位置:绝对的;
右:0;
下:-0.2 em;
宽度:1.5 em;
text-align:正确;
高度:2 em;
min-width:41 px;
文字修饰:没有;
背景:url(text-fade.png)repeat-y;
显示:没有;
}
。textOverflow div._textUnderflow {
溢出:汽车;
}
。textOverflow div._textUnderflow ins {
显示:没有;
}
。textOverflow div._textOverflow {
溢出:隐藏;
}
。textOverflow div._textOverflow ins {
显示:块;
}
table.textOverflow {
表布局:固定;
}
/风格
在身体中写入:
标题 / h1
在IE和火狐的操作上都是很有效果的。
如果每行中的文本超过了每行的宽度,那么您将看到“……”(省略)出现在每一行的末尾。
试着调整窗口大小或者改变字体大小
原创力文档

文档评论(0)