<DIV id=fly1
style="LEFT: 40%; WIDTH: 自己设px; POSITION: absolute; TOP: 40%; HEIGHT: 自己设px">
style="LEFT: 40%; WIDTH: 自己设px; POSITION: absolute; TOP: 40%; HEIGHT: 自己设px">
解决方案 »
- 急需帮忙~关于js
- 组织<a >默认打开href动作,请问如何作?
- js高亮显示代码段的问题
- 问个问题,table能获得top的值吗?就像div的style.top这样的值
- Response.Write("<script>alert("+strResult+")</script>") 弹出消息对话框的问题
- VISTA+IE7上弹出脚本错误的提示
- 大家给看看下面的正则表达式有区别吗,怎么我总觉一样呢???(判断非负整数)
- 制作框架的拖动条,出现的问题!
- 请问如何在文本框中输入值后,回车自动从数据库中找出相应的其它值填充到其它框内。
- 控制输入一问?
- 谁有日期小写转大写的函数??如1982-10-29转成一九八二年十月二十九日
- 用javascript怎么控制<input>从不可写,变成可写,?
style="LEFT: 40%; WIDTH: 自己设px; POSITION: absolute; TOP: 40%; HEIGHT: 自己设px">
<SCRIPT LANGUAGE="JavaScript">
window.onload = centre;
window.onresize = centre;
function centre() {
var dw = document.body.clientWidth;
var dh = document.body.clientHeight;
var obj = document.getElementById("c");
var ow = obj.offsetWidth;
var oh = obj.offsetHeight;
with(obj.style) {
left = dw/2-ow/2;
top = dh/2-oh/2;
}
}
</SCRIPT>
<body>
<div id="c" style="width:150px;height:150px;border:1px solid black;background-color:gray;position:absolute;"></div>
如果我不只一个层呢???
如果有几个层~~~怎么办??
谢谢!!
给你一个例子。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
</head><body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center"><div id="Layer1" style="position:absolute; width:10px; height:10px; z-index:1">
<div id="Layer4" style="position:absolute; width:200px; height:44px; z-index:3; background-color: #FF00FF; layer-background-color: #FF00FF; border: 1px none #000000; left: -1px; top: 26px;">层...</div>
<br> <div id="Layer3" style="position:absolute; width:200px; height:49px; z-index:2; background-color: #0000FF; layer-background-color: #0000FF; border: 1px none #000000; top: 74px; left: -1px;">层2</div>
<br>
<div id="Layer2" style="position:absolute; width:200px; height:46px; z-index:1; background-color: #993333; layer-background-color: #993333; border: 1px none #000000; left: -1px; top: 126px;">层1</div>
</div>
层总在我旁边 </td>
</tr>
</table>
</body>
</html>
是这样的吧?呵呵。。