请问这个效果怎么实现?
就是这个论坛下面的广告鼠标放上去的提示信息,就是带米黄色,又有点透明的(FF浏览器可能看不到)
我也查看过相关文件知道是通过
http://bbs.rainbowsoft.org/include/common.js这个中的以下代码来实现的,但是我把这些代码插入到z-Blog中的common.js文件时,上传后却没有这样的效果,就连原来有文字提示的图片都没有文字出来了。
是不是代码之间有冲突?
请问如何实现这样的效果?
引用:
var sPop = null;
function $(id) {
return document.getElementById(id);
}
function in_array(needle, haystack) {
if(typeof needle == 'string') {
for(var i in haystack) {
if(haystack == needle) {
return true;
}
}
}
return false;
}
document.write("<style type='text/css'id='defaultPopStyle'>");
document.write(".cPopText { font-family: Tahoma, Verdana; background-color: #FFFFCC; border: 1px #000000 solid; font-size: 12px; padding-right: 4px; padding-left: 4px; line-height: 18px; padding-top: 2px; padding-bottom: 2px; visibility: hidden; filter: Alpha(Opacity=80)}");
document.write("</style>");
document.write("<div id='popLayer' style='position:absolute;z-index:1000' class='cPopText'></div>");
function showPopupText(event) {
if(event.srcElement) o = event.srcElement; else o = event.target;
if(!o) {
return;
}
MouseX = event.clientX;
MouseY = event.clientY;
if(o.alt != null && o.alt != '') {
o.pop = o.alt;
o.alt = '';
}
if(o.title != null && o.title != '') {
o.pop = o.title;
o.title = '';
}
if(o.pop != sPop) {
sPop = o.pop;
if(sPop == null || sPop == '') {
$('popLayer').style.visibility = "hidden";
} else {
popStyle = o.dyclass != null ? o.dyclass : 'cPopText';
$('popLayer').style.visibility = "visible";
showIt();
}
}
}
function showIt() {
$('popLayer').className = popStyle;
$('popLayer').innerHTML = sPop.replace(/<(.*)>/g,"<$1>").replace(/\n/g,"<br>");
var popWidth = $('popLayer').clientWidth;
var popHeight = $('popLayer').clientHeight;
var popLeftAdjust = MouseX + 12 + popWidth > document.body.clientWidth ? -popWidth - 24 : 0;
var popTopAdjust = MouseY + 12 + popHeight > document.body.clientHeight ? -popHeight - 24 : 0;
$('popLayer').style.left = (MouseX + 12 + document.body.scrollLeft + popLeftAdjust) + 'px';
$('popLayer').style.top = (MouseY + 12 + document.body.scrollTop + popTopAdjust) + 'px';
}
if(!document.onmouseover) {
document.onmouseover = function(e) {
var event = e ? e : window.event;
showPopupText(event);
};
}