这是一段浮动层的js效果,怎么改成一直就显示层的效果,谢谢
<scriptlanguage=javascript>varbIsCatchFlyBar=false;vardragClickX=0;vardragClickY=0;fu...
<script language=javascript>
var bIsCatchFlyBar = false;
var dragClickX = 0;
var dragClickY = 0;
function HideFlyBar(){
divFlyBar.style.visibility = "hidden";
myFlyBarRestorButton.style.display = '';
}
function openFlyBar(){
myload_flybar();
divFlyBar.style.visibility = "visible";
myFlyBarRestorButton.style.display = "none";
}
function catchFlyBar(e){
bIsCatchFlyBar = true;
var x=event.x+document.body.scrollLeft;
var y=event.y+document.body.scrollTop;
dragClickX=x-divFlyBar.style.pixelLeft;
dragClickY=y-divFlyBar.style.pixelTop;
divFlyBar.setCapture();
document.onmousemove = moveFlyBar;
}
function releaseFlyBar(e){
bIsCatchFlyBar = false;
divFlyBar.releaseCapture();
document.onmousemove = null;
}
function moveFlyBar(e){
if(bIsCatchFlyBar){
divFlyBar.style.left = event.x+document.body.scrollLeft-dragClickX;
divFlyBar.style.top = event.y+document.body.scrollTop-dragClickY;
}
}
function myload_flybar(){
divFlyBar.style.top=document.body.scrollTop;
divFlyBar.style.left=document.body.offsetWidth-divFlyBar.clientWidth-30+document.body.scrollLeft;
}
window.onresize = myload_flybar;
window.onscroll = myload_flybar;
window.onload = openFlyBar;
</script>
<div id=divFlyBar onMouseDown="catchFlyBar()" onMouseUp="releaseFlyBar()" style='position:absolute;top:0;left:1;visibility:hidden;cursor:move;z-index:100'>
<table style="filter:alpha(opacity=90);background-color:#9A9A9A;" width=192 border="0" cellspacing="1" cellpadding="0"><tr><td><table width=100% border=0 cellpadding=0 cellspacing=0><tr valign=middle style="background-color:#212121;"><td><img src="http://www.zeali.net/pic/z-smallLogo.gif" align="absmiddle" border=0 width=12 height=12></td><td style="font-size:12px;color:#F4F4F4;font-weight:bold" width=100% align=left> Z-Tips</td><td align=right valign=top><img src="http://www.zeali.net/pic/button-Close.gif" onclick=javascript:HideFlyBar() alt="关闭X" title="关闭X" width=11 height=11 border=0 align="absmiddle" onmouseover="divFlyBar.style.cursor='hand';" onmouseout="divFlyBar.style.cursor='move';"></td></tr></table></td></tr>
<tr id=flyTailerTr name=flyTailerTr><td id=flyTailerHolder name=flyTailerHolder style='background-color:#eeeeee;color:black;font-weight:bold;font-size:12px;font-family:Courier New;' align=center>
在这里放置东西<br>
在这里放置东西<br>
在这里放置东西<br>
</td></tr>
</table>
</div>
<div id=myFlyBarRestorButton name=myFlyBarRestorButton align=center valign=middle><input type=button value='▲ 显示 ▲' onclick=javascript:openFlyBar()></div>
.
现在是必须要先点击“显示”按钮那个层才出来,我要的效果是一进入页面这个层就是显示状态。谢谢
那也说明可能存在问题,要么直接改成显示的,不要关闭功能也行
. 展开
var bIsCatchFlyBar = false;
var dragClickX = 0;
var dragClickY = 0;
function HideFlyBar(){
divFlyBar.style.visibility = "hidden";
myFlyBarRestorButton.style.display = '';
}
function openFlyBar(){
myload_flybar();
divFlyBar.style.visibility = "visible";
myFlyBarRestorButton.style.display = "none";
}
function catchFlyBar(e){
bIsCatchFlyBar = true;
var x=event.x+document.body.scrollLeft;
var y=event.y+document.body.scrollTop;
dragClickX=x-divFlyBar.style.pixelLeft;
dragClickY=y-divFlyBar.style.pixelTop;
divFlyBar.setCapture();
document.onmousemove = moveFlyBar;
}
function releaseFlyBar(e){
bIsCatchFlyBar = false;
divFlyBar.releaseCapture();
document.onmousemove = null;
}
function moveFlyBar(e){
if(bIsCatchFlyBar){
divFlyBar.style.left = event.x+document.body.scrollLeft-dragClickX;
divFlyBar.style.top = event.y+document.body.scrollTop-dragClickY;
}
}
function myload_flybar(){
divFlyBar.style.top=document.body.scrollTop;
divFlyBar.style.left=document.body.offsetWidth-divFlyBar.clientWidth-30+document.body.scrollLeft;
}
window.onresize = myload_flybar;
window.onscroll = myload_flybar;
window.onload = openFlyBar;
</script>
<div id=divFlyBar onMouseDown="catchFlyBar()" onMouseUp="releaseFlyBar()" style='position:absolute;top:0;left:1;visibility:hidden;cursor:move;z-index:100'>
<table style="filter:alpha(opacity=90);background-color:#9A9A9A;" width=192 border="0" cellspacing="1" cellpadding="0"><tr><td><table width=100% border=0 cellpadding=0 cellspacing=0><tr valign=middle style="background-color:#212121;"><td><img src="http://www.zeali.net/pic/z-smallLogo.gif" align="absmiddle" border=0 width=12 height=12></td><td style="font-size:12px;color:#F4F4F4;font-weight:bold" width=100% align=left> Z-Tips</td><td align=right valign=top><img src="http://www.zeali.net/pic/button-Close.gif" onclick=javascript:HideFlyBar() alt="关闭X" title="关闭X" width=11 height=11 border=0 align="absmiddle" onmouseover="divFlyBar.style.cursor='hand';" onmouseout="divFlyBar.style.cursor='move';"></td></tr></table></td></tr>
<tr id=flyTailerTr name=flyTailerTr><td id=flyTailerHolder name=flyTailerHolder style='background-color:#eeeeee;color:black;font-weight:bold;font-size:12px;font-family:Courier New;' align=center>
在这里放置东西<br>
在这里放置东西<br>
在这里放置东西<br>
</td></tr>
</table>
</div>
<div id=myFlyBarRestorButton name=myFlyBarRestorButton align=center valign=middle><input type=button value='▲ 显示 ▲' onclick=javascript:openFlyBar()></div>
.
现在是必须要先点击“显示”按钮那个层才出来,我要的效果是一进入页面这个层就是显示状态。谢谢
那也说明可能存在问题,要么直接改成显示的,不要关闭功能也行
. 展开
1个回答
展开全部
是直接显示的啊 是不是跟IE版本有关啊 在我机器上测试不点button直接显示在右上角了 你再试试
直接显示的话你把最下面那一段DIV标签去掉就可以了 (删除<div id=myFlyBarRestorButton name=myFlyBarRestorButton align=center valign=middle><input type=button value='▲ 显示 ▲' onclick=javascript:openFlyBar()></div>)
如果不想要关闭功能的话:下面是修改后的 可以用。
<script language=javascript>
var bIsCatchFlyBar = false;
var dragClickX = 0;
var dragClickY = 0;
function HideFlyBar(){
divFlyBar.style.visibility = "hidden";
myFlyBarRestorButton.style.display = '';
}
function openFlyBar(){
myload_flybar();
divFlyBar.style.visibility = "visible";
myFlyBarRestorButton.style.display = "none";
}
function catchFlyBar(e){
bIsCatchFlyBar = true;
var x=event.x+document.body.scrollLeft;
var y=event.y+document.body.scrollTop;
dragClickX=x-divFlyBar.style.pixelLeft;
dragClickY=y-divFlyBar.style.pixelTop;
divFlyBar.setCapture();
document.onmousemove = moveFlyBar;
}
function releaseFlyBar(e){
bIsCatchFlyBar = false;
divFlyBar.releaseCapture();
document.onmousemove = null;
}
function moveFlyBar(e){
if(bIsCatchFlyBar){
divFlyBar.style.left = event.x+document.body.scrollLeft-dragClickX;
divFlyBar.style.top = event.y+document.body.scrollTop-dragClickY;
}
}
function myload_flybar(){
divFlyBar.style.top=document.body.scrollTop;
divFlyBar.style.left=document.body.offsetWidth-divFlyBar.clientWidth-
30+document.body.scrollLeft;
}
window.onresize = myload_flybar;
window.onscroll = myload_flybar;
window.onload = openFlyBar;
</script>
<div id=divFlyBar onMouseDown="catchFlyBar()" onMouseUp="releaseFlyBar()"
style='position:absolute;top:0;left:1;visibility:hidden;cursor:move;z-
index:100'>
<table style="filter:alpha(opacity=90);background-color:#9A9A9A;" width=192
border="0" cellspacing="1" cellpadding="0"><tr><td><table width=100% border=0
cellpadding=0 cellspacing=0><tr valign=middle style="background-
color:#212121;"><td><img src="http://www.zeali.net/pic/z-smallLogo.gif"
align="absmiddle" border=0 width=12 height=12></td></tr></table></td></tr>
<tr id=flyTailerTr name=flyTailerTr><td id=flyTailerHolder name=flyTailerHolder
style='background-color:#eeeeee;color:black;font-weight:bold;font-
size:12px;font-family:Courier New;' align=center>
在这里放置东西<br>
在这里放置东西<br>
在这里放置东西<br>
</td></tr>
</table>
</div>
直接显示的话你把最下面那一段DIV标签去掉就可以了 (删除<div id=myFlyBarRestorButton name=myFlyBarRestorButton align=center valign=middle><input type=button value='▲ 显示 ▲' onclick=javascript:openFlyBar()></div>)
如果不想要关闭功能的话:下面是修改后的 可以用。
<script language=javascript>
var bIsCatchFlyBar = false;
var dragClickX = 0;
var dragClickY = 0;
function HideFlyBar(){
divFlyBar.style.visibility = "hidden";
myFlyBarRestorButton.style.display = '';
}
function openFlyBar(){
myload_flybar();
divFlyBar.style.visibility = "visible";
myFlyBarRestorButton.style.display = "none";
}
function catchFlyBar(e){
bIsCatchFlyBar = true;
var x=event.x+document.body.scrollLeft;
var y=event.y+document.body.scrollTop;
dragClickX=x-divFlyBar.style.pixelLeft;
dragClickY=y-divFlyBar.style.pixelTop;
divFlyBar.setCapture();
document.onmousemove = moveFlyBar;
}
function releaseFlyBar(e){
bIsCatchFlyBar = false;
divFlyBar.releaseCapture();
document.onmousemove = null;
}
function moveFlyBar(e){
if(bIsCatchFlyBar){
divFlyBar.style.left = event.x+document.body.scrollLeft-dragClickX;
divFlyBar.style.top = event.y+document.body.scrollTop-dragClickY;
}
}
function myload_flybar(){
divFlyBar.style.top=document.body.scrollTop;
divFlyBar.style.left=document.body.offsetWidth-divFlyBar.clientWidth-
30+document.body.scrollLeft;
}
window.onresize = myload_flybar;
window.onscroll = myload_flybar;
window.onload = openFlyBar;
</script>
<div id=divFlyBar onMouseDown="catchFlyBar()" onMouseUp="releaseFlyBar()"
style='position:absolute;top:0;left:1;visibility:hidden;cursor:move;z-
index:100'>
<table style="filter:alpha(opacity=90);background-color:#9A9A9A;" width=192
border="0" cellspacing="1" cellpadding="0"><tr><td><table width=100% border=0
cellpadding=0 cellspacing=0><tr valign=middle style="background-
color:#212121;"><td><img src="http://www.zeali.net/pic/z-smallLogo.gif"
align="absmiddle" border=0 width=12 height=12></td></tr></table></td></tr>
<tr id=flyTailerTr name=flyTailerTr><td id=flyTailerHolder name=flyTailerHolder
style='background-color:#eeeeee;color:black;font-weight:bold;font-
size:12px;font-family:Courier New;' align=center>
在这里放置东西<br>
在这里放置东西<br>
在这里放置东西<br>
</td></tr>
</table>
</div>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询