显示不下弹出DIV辅助显示


// js方法
function txtMouseOver(obj) {
try {
var txtRange = obj.createTextRange();
var strValue = obj.value;
obj.value = "";
var txtWidth = obj.scrollWidth;
obj.value = strValue;
var fontWidth = txtRange.boundingWidth;
if (fontWidth <= txtWidth) {
return;
}
var strHTML = "";
strHTML += "<table border=0>";
strHTML += "<tr>";
strHTML += " <td class = 'msg'><div align='center'>" + strValue + "</div></td>";
strHTML += "</tr>";
strHTML += "</table>";

oRect = obj.getBoundingClientRect();

document.all["msgBox"].innerHTML = strHTML;
if (document.body.clientWidth < parseInt(oRect.left) + parseInt(txtWidth) + 2 + parseInt(fontWidth)) {
document.all["msgBox"].style.posLeft = document.body.scrollLeft + oRect.left - 17 - fontWidth;
} else {
document.all["msgBox"].style.posLeft = document.body.scrollLeft + oRect.left + txtWidth + 2;
}
document.all["msgBox"].style.posTop = document.body.scrollTop + oRect.top - 5;
document.all["msgBox"].style.filter="alpha(opacity=100)";
} catch(E) {
}
}

function txtMouseOut(obj) {
try {
document.all["msgBox"].innerHTML = "";
} catch(E) {
}
}

// html页面
<input style="width:290px" onMouseOver="txtMouseOver(this)" onMouseOut="txtMouseOut(this)" type="text" class="" readonly value="<%=test%>">
<div id="msgBox" style="position: absolute; left: 0px; top: 0px;"></div>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值