浮动提示窗口问题。 这段代码是从网上找的,<a>里的 class="a1"是什么意思?son=hint alt="浮动提示内容"又表示什么?小弟比较菜,请解释一下。^_^ 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 class是css的样式?var oSon=window.document.getElementById(son); 是找dom中的id=son的,你的 程序中没有,肯定就是null了,这样的程序多了,看一个好一点的! 可是我看它原来的程序就是 son=hint 这样写的,可以出现提示。 在他的页面中肯定有一个id=son的div你查找一下吧,然后把这个DIV复制到你的页面中 Try..var oSon=window.document.getElementById(son);//为什么oSon总是null呢?->var oSon = element.son; to ice_berg16(寻梦的稻草人): 我找了,确实没有。to wanghr100(灰豆宝宝.net) : 这样写,提示不是浮动的,而是把原来网页的内容都变了。我是想实现http://www.rongshuxia.com/里面的文章列表浮动提示效果,可是怎么也不行。 问题解决了,下面贴出源代码,希望对需要解决问题的人有帮助。(共三个文件,放在同一目录下即可。)____________________________________________________________________test.htm____________________________________________________________________<head><div align="left" id="divtip" style="width:250px;border:1px solid #000000;background:#9FC383;position:absolute;z-index:1000;padding:4px;line-height:17px" id="divtip;display: none" style="display: none"></div></head><body> <a style="behavior:url(hint.htc)" son="divtip" alt="提示..." target="_blank" href="" >连接</a></body></html>____________________________________________________________________hint.css____________________________________________________________________.hint {width:250px;border:1px solid #000000;background:#9FC383;position:absolute;z-index:1000;padding:4px;line-height:17px;}.onit {behavior:url(hint.htc);}____________________________________________________________________hint.htc____________________________________________________________________<PUBLIC:PROPERTY NAME="son" /><PUBLIC:ATTACH EVENT="onmouseover" ONEVENT="onit()" /><PUBLIC:ATTACH EVENT="onmousemove" ONEVENT="onit()" /><PUBLIC:ATTACH EVENT="onmouseout" ONEVENT="noit()" /><SCRIPT>function onit() {alert("onit");var oSon=window.document.getElementById(son);if (oSon==null) {alert("null");return;}with (oSon) {innerText=alt;style.display="block";style.pixelLeft=window.event.clientX+window.document.body.scrollLeft+6;style.pixelTop=window.event.clientY+window.document.body.scrollTop+9;}}function noit() {var oSon=window.document.getElementById(son);if (oSon==null) return;oSon.style.display="none";}</SCRIPT> onclick事件 高分 用户设置页面刷新时间 请问我写的这段分时问候JS代码错误在哪? JS中对精确到秒的时间比较 javascript关闭窗口 Cache的问题,请高人指点 复选框选中生成文本框问题(动态生成) 请问如何在一个页面控制另一个页面中的radio 谁能提供一个数据库是(4,2)要求的,在前台的判断是否数值的函数? 高手帮忙!关于超链接! 图片飘动(急,在线等) 如何从字frame页中利用form.submit()提交父页面的表单,我试了parent.form.submit()就是不行,在线等待,解决立刻结分
var oSon=window.document.getElementById(son); 是找dom中的id=son的,你的
程序中没有,肯定就是null了,这样的程序多了,看一个好一点的!
你查找一下吧,然后把这个DIV复制到你的页面中
->
var oSon = element.son;
我找了,确实没有。to wanghr100(灰豆宝宝.net) :
这样写,提示不是浮动的,而是把原来网页的内容都变了。我是想实现http://www.rongshuxia.com/里面的文章列表浮动提示效果,可是怎么也不行。
(共三个文件,放在同一目录下即可。)
____________________________________________________________________
test.htm
____________________________________________________________________
<head>
<div align="left" id="divtip" style="width:250px;border:1px solid #000000;background:#9FC383;position:absolute;z-index:1000;padding:4px;line-height:17px" id="divtip;display: none" style="display: none"></div>
</head>
<body>
<a style="behavior:url(hint.htc)" son="divtip" alt="提示..." target="_blank" href="" >连接</a>
</body>
</html>
____________________________________________________________________
hint.css
____________________________________________________________________
.hint {width:250px;border:1px solid #000000;background:#9FC383;position:absolute;z-index:1000;padding:4px;line-height:17px;}
.onit {behavior:url(hint.htc);}
____________________________________________________________________
hint.htc
____________________________________________________________________
<PUBLIC:PROPERTY NAME="son" />
<PUBLIC:ATTACH EVENT="onmouseover" ONEVENT="onit()" />
<PUBLIC:ATTACH EVENT="onmousemove" ONEVENT="onit()" />
<PUBLIC:ATTACH EVENT="onmouseout" ONEVENT="noit()" />
<SCRIPT>
function onit() {
alert("onit");
var oSon=window.document.getElementById(son);
if (oSon==null) {alert("null");return;}
with (oSon) {
innerText=alt;
style.display="block";
style.pixelLeft=window.event.clientX+window.document.body.scrollLeft+6;
style.pixelTop=window.event.clientY+window.document.body.scrollTop+9;
}
}function noit() {
var oSon=window.document.getElementById(son);
if (oSon==null) return;
oSon.style.display="none";
}
</SCRIPT>