首页上一页 1 下一页尾页 1 条记录 1/1页
html id能否重复?
发表在PHP图书答疑
2012-04-12
是否精华
是
否
版块置顶:
是
否
项目开发案例 3章办公自动化 index.php
<form [font color=#00FF00]id="login"[/font] name="login" method="post" action="index_ok.php">
<table width="100%" height="620" border="0" cellpadding="0" cellspacing="0" background="images/login_bg.jpg">
<tr>
<td colspan="3" height="150"> </td>
</tr>
<tr>
<td> </td>
<td width="315" height="199" align="center" valign="middle">
<table width="315" height="199" border="0" cellpadding="0" cellspacing="0" background="images/login_center.jpg">
<tr>
<td height="74" colspan="2" align="center" valign="middle"> </td>
</tr>
<tr>
<td width="140" height="25" align="right" valign="middle"><span id="lg">用户名称:</span></td>
<td width="175" align="left" valign="middle"><input name="username" type="text" id="username" size="15" /></td>
</tr>
<tr>
<td height="25" align="right" valign="middle"><span id="lg">用户密码:</span></td>
<td align="left" valign="middle"><input name="pwd" type="password" id="pwd" size="15" /></td>
</tr>
<tr>
<td height="25" align="right" valign="middle"><span id="lg">用户组:</span></td>
<td align="left" valign="middle">
<select name="u_group" style=" width:115px;">
<?php
$sqlstr = "select * from tb_group";
$result = mysql_query($sqlstr,$conn);
while($rows = mysql_fetch_row($result)){
echo "<option value=".$rows[0].">".$rows[1]."</option>";
}
?>
</select> </td>
</tr>
<tr>
<td height="50" colspan="2" align="center" valign="middle">
<input type="hidden" name="action" value="login" />
<input type="submit" name="login" [font color=#00FF00]id="login"[/font] value="" onclick="return chk_lg();"/>
<input type="reset" name="reset" id="reset" value="" /></td>
</tr>
</table>
</td>
<td> </td>
</tr>
<tr>
<td colspan="3" height="155"> </td>
</tr>
</table>
</form>
css文件部分代码:
[font color=#FF0000]#login [/font]#login {
background-attachment: fixed;
background-image: url(../images/button_enter.jpg);
background-repeat: no-repeat;
background-position: center center;
height: 17px;
width: 39px;
BORDER-BOTTOM: #52798C 1px solid;
BORDER-LEFT: #52798C 1px solid;
BORDER-RIGHT: #52798C 1px solid;
BORDER-TOP: #52798C 1px solid;
color:#52798C;
}
[font color=#FF0000]#login [/font]#reset {
background-attachment: fixed;
background-image: url(../images/button_reset.jpg);
background-repeat: no-repeat;
background-position: center center;
height: 17px;
width: 39px;
BORDER-BOTTOM: #52798C 1px solid;
BORDER-LEFT: #52798C 1px solid;
BORDER-RIGHT: #52798C 1px solid;
BORDER-TOP: #52798C 1px solid;
color:#52798C;
}
-----
1.html中id可以重复吗?教材上说不能重复吗,怎么上面的(绿色)可以?
2.css红色的]#login 指的是表单id吗,浏览器是怎么判断是表单id而不是提交按钮id的?
<form [font color=#00FF00]id="login"[/font] name="login" method="post" action="index_ok.php">
<table width="100%" height="620" border="0" cellpadding="0" cellspacing="0" background="images/login_bg.jpg">
<tr>
<td colspan="3" height="150"> </td>
</tr>
<tr>
<td> </td>
<td width="315" height="199" align="center" valign="middle">
<table width="315" height="199" border="0" cellpadding="0" cellspacing="0" background="images/login_center.jpg">
<tr>
<td height="74" colspan="2" align="center" valign="middle"> </td>
</tr>
<tr>
<td width="140" height="25" align="right" valign="middle"><span id="lg">用户名称:</span></td>
<td width="175" align="left" valign="middle"><input name="username" type="text" id="username" size="15" /></td>
</tr>
<tr>
<td height="25" align="right" valign="middle"><span id="lg">用户密码:</span></td>
<td align="left" valign="middle"><input name="pwd" type="password" id="pwd" size="15" /></td>
</tr>
<tr>
<td height="25" align="right" valign="middle"><span id="lg">用户组:</span></td>
<td align="left" valign="middle">
<select name="u_group" style=" width:115px;">
<?php
$sqlstr = "select * from tb_group";
$result = mysql_query($sqlstr,$conn);
while($rows = mysql_fetch_row($result)){
echo "<option value=".$rows[0].">".$rows[1]."</option>";
}
?>
</select> </td>
</tr>
<tr>
<td height="50" colspan="2" align="center" valign="middle">
<input type="hidden" name="action" value="login" />
<input type="submit" name="login" [font color=#00FF00]id="login"[/font] value="" onclick="return chk_lg();"/>
<input type="reset" name="reset" id="reset" value="" /></td>
</tr>
</table>
</td>
<td> </td>
</tr>
<tr>
<td colspan="3" height="155"> </td>
</tr>
</table>
</form>
css文件部分代码:
[font color=#FF0000]#login [/font]#login {
background-attachment: fixed;
background-image: url(../images/button_enter.jpg);
background-repeat: no-repeat;
background-position: center center;
height: 17px;
width: 39px;
BORDER-BOTTOM: #52798C 1px solid;
BORDER-LEFT: #52798C 1px solid;
BORDER-RIGHT: #52798C 1px solid;
BORDER-TOP: #52798C 1px solid;
color:#52798C;
}
[font color=#FF0000]#login [/font]#reset {
background-attachment: fixed;
background-image: url(../images/button_reset.jpg);
background-repeat: no-repeat;
background-position: center center;
height: 17px;
width: 39px;
BORDER-BOTTOM: #52798C 1px solid;
BORDER-LEFT: #52798C 1px solid;
BORDER-RIGHT: #52798C 1px solid;
BORDER-TOP: #52798C 1px solid;
color:#52798C;
}
-----
1.html中id可以重复吗?教材上说不能重复吗,怎么上面的(绿色)可以?
2.css红色的]#login 指的是表单id吗,浏览器是怎么判断是表单id而不是提交按钮id的?