两个不同文件位置的浮动JS.但客户端显示在同一页面上.JS实现代码一样.一个是全局的客服浮动.另一个是某个页面内的单个浮动.并不是对联浮动!为什么两个浮动广告总有一个广告的JS脚本不起作用???或是左侧的不管用或是右侧的不管用另(单机DW8测试时浏览器提示"已限制此脚本运行...",点击允许后就可以正常浮动了)
代码如下:
<script>
var tips;
var theTop = 100;
var old = theTop;
function initFloatTips() {
tips = document.getElementById('Floatbox');
moveTips();
}
function moveTips() {
var tt = 50;
if (window.innerHeight) {
pos = window.pageYOffset
} else if (document.documentElement && document.documentElement.scrollTop) {
pos = document.documentElement.scrollTop
} else if (document.body) {
pos = document.body.scrollTop;
}
pos = pos - tips.offsetTop + theTop;
pos = tips.offsetTop + pos / 10;
if (pos < theTop) {
pos = theTop;
}
if (pos != old) {
tips.style.top = pos + "px";
tt = 10;
}
old = pos;
setTimeout(moveTips, tt);
}
initFloatTips();
function closeBox()
{
document.getElementById("Floatbox").style.display = "none"
}
</script>
代码如下:
<script>
var tips;
var theTop = 100;
var old = theTop;
function initFloatTips() {
tips = document.getElementById('Floatbox');
moveTips();
}
function moveTips() {
var tt = 50;
if (window.innerHeight) {
pos = window.pageYOffset
} else if (document.documentElement && document.documentElement.scrollTop) {
pos = document.documentElement.scrollTop
} else if (document.body) {
pos = document.body.scrollTop;
}
pos = pos - tips.offsetTop + theTop;
pos = tips.offsetTop + pos / 10;
if (pos < theTop) {
pos = theTop;
}
if (pos != old) {
tips.style.top = pos + "px";
tt = 10;
}
old = pos;
setTimeout(moveTips, tt);
}
initFloatTips();
function closeBox()
{
document.getElementById("Floatbox").style.display = "none"
}
</script>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货