当前位置:编程学习 > html/css >>

html嵌入php中的css问题

为什么下面那个red和juzhi没有作用? <?php include("conn.php"); error_reporting(0); if($_GET['out']){ setcookie("cookie","out"); //echo "<script language=\"javascript\">location.href='login.php';</script>"; exit(); } if(isset($_POST['submit'])){ $sel="select * from `leave` where `user`='".$_POST['id']."' and `pw`='".$_POST['pw']."'"; $query=mysql_query($sel); $row=mysql_num_rows($query); if($row<>0){ //if($_POST['pw'] == 'admin'){ setcookie("cookie","ok"); echo "<script language=\"javascript\">location.href='head.php';</script>"; exit(); //} } } if($_COOKIE['cookie'] !== 'ok'){ ?> <script language=javascript> function checklogin(){ if(login.id.value==""){ alert("用户名不能为空"); login.id.focus(); return false; } if(login.pw.value==""){ alert("密码不能为空"); login.pw.focus(); return false; } } </script> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>无标题文档</title> <style> .juzhi { width:400px; margin-top:0; margin-left:auto; margin-bottom:0; margin-right:auto; padding:100px; background-image:url('bg.jpg'); background-repeat:no-repeat; } .login_error { height:15px; align:center; margin-top: 0px; margin-right: auto; margin-bottom: 0px; margin-left: auto; width: 200px; } .red { color:#f00; } </style> </head> <body> <?php //echo '你好'$_POST['id']; include("head.php"); ?> <div class="juzhi"> <form action="" name="login" method="post" onsubmit="return checklogin();">  ID:  <input type="text" name="id" /><br /> 密码: <input type="password" name="pw" /><br /> <input type="submit" name="submit" value="登录" /> </div> </form> </body> </html> <?php }else { ?> <div class="red">用户名、密码错误!</div> <div class="juzhi"> <form action="" name="login" method="post" onsubmit="return checklogin();">  ID:  <input type="text" name="id" /><br /> 密码: <input type="password" name="pw" /><br /> <input type="submit" name="submit" value="登录" /> </div> <?php } ?>
答案:-_,-@  不在body 内,为啥想它能生效?
其他:LS的,CSS写在head里面是完全合法的,LZ不晓得你那个 $_COOKIE['cookie'] !== 'ok' 这个表达式成立木有,如果木有成立的话,那个定义CSS的style表情就不会显示,你看下源码里面能不能看到CSS先 LS:
看最后一部分,连在HTML标签外的,还能有效? 

上一个:我有个关于CSS编码的问题,是li和ul标签,请问以下代码如何变成横向?
下一个:关于css背景图片调用问题

CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,