onmouseover问题 要显示的内容为aasdfadsfasdfasghhhhhhderrrrrrrrrrghhhhh因为内容比较长,在网页上只显示部分内容。比如aasdfadsfasdfa当鼠标移动到该位置时弹出个小框框显示全部内容。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 title 很难用,而且无法随意添加样式,使用很不理想!类似问题前两天刚好有人问到,封装了一下L@_@K<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>js.smartTitle</title> <meta name="generator" content="editplus" /> <meta name="author" content="" /> <meta name="keywords" content="" /> <meta name="description" content="" /> </head> <body> <input type="text" id="txtHehe" value="把鼠标移上来看看哈" /> <input type="text" id="txtHaha" value="把鼠标移上来看看哈" /> <input type="text" id="txtHeihei" title="title 效果!" value="把鼠标移上来看看哈" /> <div id="divShort" style="width: 89px; overflow: hidden;">aasdfadsfasdfasghhhhhhderrrrrrrrrrghhhhh </div> </body> <script type="text/javascript"> <!--function AddSmartTitle(sId, innerHTML){ if (this.TipRegion === undefined) { this.TipRegion = document.body.appendChild(document.createElement("div")); this.TipRegion.style.padding = "5px 5px 5px 5px"; this.TipRegion.style.fontSize = "9pt"; this.TipRegion.style.border = "dotted 1px black"; this.TipRegion.style.backgroundColor = "#ffffcc"; this.TipRegion.style.display = "none"; } var target = document.getElementById(sId); if (target) { target.TipRegion = this.TipRegion; target.onmouseover = function(event) { event = event ? event : window.event; this.TipRegion.style.position = "absolute"; var topDis = (document.documentElement.scrollTop > 0) ? document.documentElement.scrollTop : document.body.scrollTop; this.TipRegion.style.top = event.clientY + topDis + "px"; this.TipRegion.style.left = event.clientX + "px"; this.TipRegion.style.display = "block"; this.TipRegion.innerHTML = innerHTML; }; target.onmouseout = function() { this.TipRegion.style.display = "none"; }; }}AddSmartTitle("txtHehe", "<i style='color: blue'>只有想不到</i>,");AddSmartTitle("txtHaha", "<b style='color: red'>没有做不到</b>!<br />——yixianggao");AddSmartTitle("divShort", document.getElementById("divShort").innerText); //--> </script></html> title 适用于简单显示,使用时有延迟,而且偶尔会失效!俺滴 SmartTitle 则灵活滴多,想咋整就咋整,嘿嘿 哈,cloudgamer 发滴都是重量级滴东东,俺只封装一些好玩滴小东东 ext自定义控件 一个js游戏 multiple 取值(js) 弱智者提问:如何让文本框只能输入英文大小写和标点符合? 急!js如何实现以UltraEdit打开指定文件,并将光标移动到指定行指定列或者将指定内容选中!!! firefox中把一个层设为可编辑状态的方法怎样的? 问一个交互数据的问题.急!!!!! 请教,为什么我得不到input的value呢? 请教:在WEB里如何打开模式窗口? 问题多多。不知何解?(有兴趣的可以看看)日历 ext TabPanel里面加GridPanel的问题 急!!! 一名美工(HTML+CSS及界面设计)对于JavaScript需要掌握的什么程度?
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>js.smartTitle</title>
<meta name="generator" content="editplus" />
<meta name="author" content="" />
<meta name="keywords" content="" />
<meta name="description" content="" />
</head> <body>
<input type="text" id="txtHehe" value="把鼠标移上来看看哈" />
<input type="text" id="txtHaha" value="把鼠标移上来看看哈" />
<input type="text" id="txtHeihei" title="title 效果!" value="把鼠标移上来看看哈" />
<div id="divShort" style="width: 89px; overflow: hidden;">aasdfadsfasdfasghhhhhhderrrrrrrrrrghhhhh </div>
</body>
<script type="text/javascript">
<!--
function AddSmartTitle(sId, innerHTML)
{
if (this.TipRegion === undefined) {
this.TipRegion = document.body.appendChild(document.createElement("div"));
this.TipRegion.style.padding = "5px 5px 5px 5px";
this.TipRegion.style.fontSize = "9pt";
this.TipRegion.style.border = "dotted 1px black";
this.TipRegion.style.backgroundColor = "#ffffcc";
this.TipRegion.style.display = "none";
} var target = document.getElementById(sId);
if (target) {
target.TipRegion = this.TipRegion;
target.onmouseover = function(event) {
event = event ? event : window.event; this.TipRegion.style.position = "absolute";
var topDis = (document.documentElement.scrollTop > 0) ? document.documentElement.scrollTop : document.body.scrollTop;
this.TipRegion.style.top = event.clientY + topDis + "px";
this.TipRegion.style.left = event.clientX + "px";
this.TipRegion.style.display = "block"; this.TipRegion.innerHTML = innerHTML;
}; target.onmouseout = function() {
this.TipRegion.style.display = "none";
};
}
}AddSmartTitle("txtHehe", "<i style='color: blue'>只有想不到</i>,");
AddSmartTitle("txtHaha", "<b style='color: red'>没有做不到</b>!<br />——yixianggao");
AddSmartTitle("divShort", document.getElementById("divShort").innerText);
//-->
</script>
</html>