代码改变世界

php页面背景颜色变更

2016-11-15 15:49  ^_^tryhard  阅读(3595)  评论(0)    收藏  举报

<?php
if(isset($_GET["cl"])){
    $color = $_GET["cl"];
    echo $color;
    echo "<style>body{background-color:$color}</style>";
}


?>
<!DOCTYPE HTML>
<html>
<head>
 <meta http-equiv="content-type" content="text/html" />
 <meta name="author" content="blog.anchen8.net" />

 <title>背景颜色变更</title>
</head>

<body>
<form action="styleChangs.php" method="get">
<select name="cl">
<option selected="true">Red</option>
<option>Blue</option>
<option>Pink</option>
<option>Black</option>
<option>Purple</option>
</select>
<input type="submit" value="chang"/>
</form>


</body>
</html>