<head><title>论坛</title>
</head>
<body>
<center>
<form action = login.jsp method=post>
用 户:<input type = text name = T1 size = 20><br><br>
密 码:<input type = password name = T2 size = 20><br><br>
</center>
</body>
</html>
这样水平方向在中间了,怎么让它也处于竖直的*呢?
7 个解决方案
#1
在<body>和</body>之间插入表格<table width=100% height=100% cellpadding=0 cellspacing=0><tr><td align="center"></td></tr></table>
这样,<td></td>里面的东西全部就居中了
或者你在表单的外层加上<div align="center>跟</div>
这样,<td></td>里面的东西全部就居中了
或者你在表单的外层加上<div align="center>跟</div>
#2
竖起的*在<body>和</body>之间插入表格<table width=100% height=100% cellpadding=0 cellspacing=0><tr><td align="center" valign="middle"></td></tr></table>把<form>……</form>放在<td></td>里面
#3
<table align='center'><form></form></table>
或者用层来定义
或者用层来定义
#4
valign="middle" 看看 form标签有没有这个属性
#5
若要表單永遠都在网页的正中间,那得放在層里,并用腳本控制它
#6
<body>
<table cellpadding=0 cellspacing=0 border=0 width=100% height=100%>
<tr><td align="center" valign="middle">
<form>.............</form>
</td>
</tr>
</table>
</body>
这样我不相信不会在中间
<table cellpadding=0 cellspacing=0 border=0 width=100% height=100%>
<tr><td align="center" valign="middle">
<form>.............</form>
</td>
</tr>
</table>
</body>
这样我不相信不会在中间
#7
<html>
<head>
<title>javascriptboy</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="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);
// -->
function MM_findObj(n, d) { //v4.0
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && document.getElementById) x=document.getElementById(n); return x;
}
function BW_centerLayers() { //v4.1.1
if (document.layers || document.all || document.getElementById){
var winWidth, winHeight, i, horz, vert, width, height, offsetX, offsetY, negX, negY, group, x, y, args;
args = BW_centerLayers.arguments;
onresize = BW_reload;
winWidth = (document.all)?document.body.clientWidth:window.innerWidth;
winHeight = (document.all)?document.body.clientHeight:window.innerHeight;
for (i=0; i<(args.length-9); i+=10) {
horz = args[i+1];
vert = args[i+2];
width = parseInt(args[i+3]);
height = parseInt(args[i+4]);
offsetX = parseInt(args[i+5]);
offsetY = parseInt(args[i+6]);
negX = args[i+7];
negY = args[i+8];
x = ((winWidth - width)/2) + offsetX;
y = ((winHeight - height)/2) + offsetY;
x = (negX=='false' && (x < 0))?0:x;
y = (negY=='false' && (y < 0))?0:y;
layerObj = (document.getElementById)?document.getElementById(args[i]):MM_findObj(args[i]);
if (layerObj!=null) {
layerObj = (layerObj.style)?layerObj.style:layerObj;
layerObj.left = (horz=="true")?x:layerObj.left;
layerObj.top = (vert=="true")?y:layerObj.top;
}
}
}
}
function BW_reload() {location.reload();}
//-->
</script>
<style type="text/css">
<!--
td { font-family: "宋体"; font-size: 12px; color: #666666}
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000" onLoad="BW_centerLayers('Layer1','true','false','150','50','0','0','false','false','false')">
<div id="Layer1" style="position:absolute; left:407px; top:107px; width:150px; height:50px; z-index:1">
<table width="150" border="0" cellspacing="1" cellpadding="0" height="50" bgcolor="#999999">
<tr>
<td bgcolor="#CCCCCC">
<div align="center">我是一个永远居中的层</div>
</td>
</tr>
</table>
</div>
</body>
</html>
<head>
<title>javascriptboy</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="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);
// -->
function MM_findObj(n, d) { //v4.0
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && document.getElementById) x=document.getElementById(n); return x;
}
function BW_centerLayers() { //v4.1.1
if (document.layers || document.all || document.getElementById){
var winWidth, winHeight, i, horz, vert, width, height, offsetX, offsetY, negX, negY, group, x, y, args;
args = BW_centerLayers.arguments;
onresize = BW_reload;
winWidth = (document.all)?document.body.clientWidth:window.innerWidth;
winHeight = (document.all)?document.body.clientHeight:window.innerHeight;
for (i=0; i<(args.length-9); i+=10) {
horz = args[i+1];
vert = args[i+2];
width = parseInt(args[i+3]);
height = parseInt(args[i+4]);
offsetX = parseInt(args[i+5]);
offsetY = parseInt(args[i+6]);
negX = args[i+7];
negY = args[i+8];
x = ((winWidth - width)/2) + offsetX;
y = ((winHeight - height)/2) + offsetY;
x = (negX=='false' && (x < 0))?0:x;
y = (negY=='false' && (y < 0))?0:y;
layerObj = (document.getElementById)?document.getElementById(args[i]):MM_findObj(args[i]);
if (layerObj!=null) {
layerObj = (layerObj.style)?layerObj.style:layerObj;
layerObj.left = (horz=="true")?x:layerObj.left;
layerObj.top = (vert=="true")?y:layerObj.top;
}
}
}
}
function BW_reload() {location.reload();}
//-->
</script>
<style type="text/css">
<!--
td { font-family: "宋体"; font-size: 12px; color: #666666}
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000" onLoad="BW_centerLayers('Layer1','true','false','150','50','0','0','false','false','false')">
<div id="Layer1" style="position:absolute; left:407px; top:107px; width:150px; height:50px; z-index:1">
<table width="150" border="0" cellspacing="1" cellpadding="0" height="50" bgcolor="#999999">
<tr>
<td bgcolor="#CCCCCC">
<div align="center">我是一个永远居中的层</div>
</td>
</tr>
</table>
</div>
</body>
</html>
#1
在<body>和</body>之间插入表格<table width=100% height=100% cellpadding=0 cellspacing=0><tr><td align="center"></td></tr></table>
这样,<td></td>里面的东西全部就居中了
或者你在表单的外层加上<div align="center>跟</div>
这样,<td></td>里面的东西全部就居中了
或者你在表单的外层加上<div align="center>跟</div>
#2
竖起的*在<body>和</body>之间插入表格<table width=100% height=100% cellpadding=0 cellspacing=0><tr><td align="center" valign="middle"></td></tr></table>把<form>……</form>放在<td></td>里面
#3
<table align='center'><form></form></table>
或者用层来定义
或者用层来定义
#4
valign="middle" 看看 form标签有没有这个属性
#5
若要表單永遠都在网页的正中间,那得放在層里,并用腳本控制它
#6
<body>
<table cellpadding=0 cellspacing=0 border=0 width=100% height=100%>
<tr><td align="center" valign="middle">
<form>.............</form>
</td>
</tr>
</table>
</body>
这样我不相信不会在中间
<table cellpadding=0 cellspacing=0 border=0 width=100% height=100%>
<tr><td align="center" valign="middle">
<form>.............</form>
</td>
</tr>
</table>
</body>
这样我不相信不会在中间
#7
<html>
<head>
<title>javascriptboy</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="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);
// -->
function MM_findObj(n, d) { //v4.0
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && document.getElementById) x=document.getElementById(n); return x;
}
function BW_centerLayers() { //v4.1.1
if (document.layers || document.all || document.getElementById){
var winWidth, winHeight, i, horz, vert, width, height, offsetX, offsetY, negX, negY, group, x, y, args;
args = BW_centerLayers.arguments;
onresize = BW_reload;
winWidth = (document.all)?document.body.clientWidth:window.innerWidth;
winHeight = (document.all)?document.body.clientHeight:window.innerHeight;
for (i=0; i<(args.length-9); i+=10) {
horz = args[i+1];
vert = args[i+2];
width = parseInt(args[i+3]);
height = parseInt(args[i+4]);
offsetX = parseInt(args[i+5]);
offsetY = parseInt(args[i+6]);
negX = args[i+7];
negY = args[i+8];
x = ((winWidth - width)/2) + offsetX;
y = ((winHeight - height)/2) + offsetY;
x = (negX=='false' && (x < 0))?0:x;
y = (negY=='false' && (y < 0))?0:y;
layerObj = (document.getElementById)?document.getElementById(args[i]):MM_findObj(args[i]);
if (layerObj!=null) {
layerObj = (layerObj.style)?layerObj.style:layerObj;
layerObj.left = (horz=="true")?x:layerObj.left;
layerObj.top = (vert=="true")?y:layerObj.top;
}
}
}
}
function BW_reload() {location.reload();}
//-->
</script>
<style type="text/css">
<!--
td { font-family: "宋体"; font-size: 12px; color: #666666}
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000" onLoad="BW_centerLayers('Layer1','true','false','150','50','0','0','false','false','false')">
<div id="Layer1" style="position:absolute; left:407px; top:107px; width:150px; height:50px; z-index:1">
<table width="150" border="0" cellspacing="1" cellpadding="0" height="50" bgcolor="#999999">
<tr>
<td bgcolor="#CCCCCC">
<div align="center">我是一个永远居中的层</div>
</td>
</tr>
</table>
</div>
</body>
</html>
<head>
<title>javascriptboy</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="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);
// -->
function MM_findObj(n, d) { //v4.0
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && document.getElementById) x=document.getElementById(n); return x;
}
function BW_centerLayers() { //v4.1.1
if (document.layers || document.all || document.getElementById){
var winWidth, winHeight, i, horz, vert, width, height, offsetX, offsetY, negX, negY, group, x, y, args;
args = BW_centerLayers.arguments;
onresize = BW_reload;
winWidth = (document.all)?document.body.clientWidth:window.innerWidth;
winHeight = (document.all)?document.body.clientHeight:window.innerHeight;
for (i=0; i<(args.length-9); i+=10) {
horz = args[i+1];
vert = args[i+2];
width = parseInt(args[i+3]);
height = parseInt(args[i+4]);
offsetX = parseInt(args[i+5]);
offsetY = parseInt(args[i+6]);
negX = args[i+7];
negY = args[i+8];
x = ((winWidth - width)/2) + offsetX;
y = ((winHeight - height)/2) + offsetY;
x = (negX=='false' && (x < 0))?0:x;
y = (negY=='false' && (y < 0))?0:y;
layerObj = (document.getElementById)?document.getElementById(args[i]):MM_findObj(args[i]);
if (layerObj!=null) {
layerObj = (layerObj.style)?layerObj.style:layerObj;
layerObj.left = (horz=="true")?x:layerObj.left;
layerObj.top = (vert=="true")?y:layerObj.top;
}
}
}
}
function BW_reload() {location.reload();}
//-->
</script>
<style type="text/css">
<!--
td { font-family: "宋体"; font-size: 12px; color: #666666}
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000" onLoad="BW_centerLayers('Layer1','true','false','150','50','0','0','false','false','false')">
<div id="Layer1" style="position:absolute; left:407px; top:107px; width:150px; height:50px; z-index:1">
<table width="150" border="0" cellspacing="1" cellpadding="0" height="50" bgcolor="#999999">
<tr>
<td bgcolor="#CCCCCC">
<div align="center">我是一个永远居中的层</div>
</td>
</tr>
</table>
</div>
</body>
</html>