<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”
“http://www.w3.org/TR/html4/loose.dtd”>
<html>
<head>
<title></title>
<script type=”text/javascript”>
function showDiv(obj,str) {
var name = obj.innerHTML;
var sDiv = document.getElementById(‘txt_’ + name.split(‘.’)[0]);//文件名自己判断
if (!sDiv) {
sDiv = document.createElement(“DIV”);
sDiv.id = ‘txt_’ + name.split(‘.’)[0];
sDiv.style.position = ‘absolute’;
sDiv.style.top = obj.offsetTop+ 22 + ‘px’;
sDiv.style.left = obj.offsetLeft+20 + ‘px’;
sDiv.style.width = 200 + ‘px’;
sDiv.style.border = ‘1px black solid’;
sDiv.style.backgroundColor=”#FFF9F4″;
sDiv.style[“word-break”] = “break-all”; //加上这行 不会出现文字有时不换行
var spanId = document.createElement(“span”);
spanId.innerHTML=str;
sDiv.appendChild(spanId);
document.body.appendChild(sDiv);
}
sDiv.style.display = ‘block’;
}
“http://www.w3.org/TR/html4/loose.dtd”>
<html>
<head>
<title></title>
<script type=”text/javascript”>
function showDiv(obj,str) {
var name = obj.innerHTML;
var sDiv = document.getElementById(‘txt_’ + name.split(‘.’)[0]);//文件名自己判断
if (!sDiv) {
sDiv = document.createElement(“DIV”);
sDiv.id = ‘txt_’ + name.split(‘.’)[0];
sDiv.style.position = ‘absolute’;
sDiv.style.top = obj.offsetTop+ 22 + ‘px’;
sDiv.style.left = obj.offsetLeft+20 + ‘px’;
sDiv.style.width = 200 + ‘px’;
sDiv.style.border = ‘1px black solid’;
sDiv.style.backgroundColor=”#FFF9F4″;
sDiv.style[“word-break”] = “break-all”; //加上这行 不会出现文字有时不换行
var spanId = document.createElement(“span”);
spanId.innerHTML=str;
sDiv.appendChild(spanId);
document.body.appendChild(sDiv);
}
sDiv.style.display = ‘block’;
}
function hideDiv(obj) {
var name = obj.innerHTML;
var sDiv = document.getElementById(‘txt_’ + name.split(‘.’)[0]);//文件名自己判断
if (sDiv) {
sDiv.style.display = ‘none’;
}
}
</script>
</head>
<body>
<div οnmοuseοver=”showDiv(this,’文字显示全了,哈哈’)” οnmοuseοut=”hideDiv(this)”
style=”position:absolute;”>文字…</div>
</body>
</html>
版权声明:本文为zz_xyz原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。