用层的时候,分辨率不同的时候往往层的位置不一样,比如说800×600的时候两个图层一个在标题栏一个在中间,但换1024×768时两个图层就都挤到标题栏去了!
哪位大侠帮忙解决一下这个问题!!
---------------------------------------------------------------
不太明白楼主想要什么样的效果~
给个始终居中的层吧!
1<div id="jnkcLayer" style="position:absolute; left:expression((document.body.clientWidth-this.offsetWidth)/2); top:expression((document.body.clientHeight-this.offsetHeight)/2); width:200px; height:200px; z-index:1; background-color: #009966">始终居中的层</div>
---------------------------------------------------------------
具体说一下 ,窗口固定位置图层
1<div id="KBStatic" style="position:absolute; left:3px; top:0px; width:553px; height:70px; z-index:25">
2<font size="5">我是大龙</font></div>
1<script language="JavaScript">
2function KB_keepItInIE(theName,theWantTop,theWantLeft) {
3theRealTop=parseInt(document.body.scrollTop)
4theTrueTop=theWantTop+theRealTop
5document.all[theName].style.top=theTrueTop
6theRealLeft=parseInt(document.body.scrollLeft)
7theTrueLeft=theWantLeft+theRealLeft
8document.all[theName].style.left=theTrueLeft
9}
10function KB_keepItInNN(theName,theWantX,theWantY) {
11theRealLay=document.layers[theName]
12theBadX=self.pageYOffset
13theBadY=self.pageXOffset
14theRealX=theBadX+theWantX
15theRealY=theBadY+theWantY
16theRealLay.moveTo(theRealY,theRealX)
17}
18IE4=(document.all)?1:0
19NN4=(document.layers)?1:0
20if (IE4)
21setInterval('KB_keepItInIE("KBStatic",0,0)',1)
22if (NN4)
23setInterval('KB_keepItInNN("KBStatic",0,0)',1)
24</script>