use*_*606 0 html javascript css
我想使用用户输入更改页面的背景颜色.到目前为止这是我的代码..
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<script type = "text/javascript">
function paintIt(){
color = prompt("Enter the color you want on the Background???");
switch (color){
}
}
</script>
<form>
<input type = "button" value = "Paint Me" onclick ="paintIt()">
</form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
而我的简单css
html {font-family:Arial, Helvetica, sans-serif; colour:#fff;}
body{background-color:#ccc; margin:0;}
Run Code Online (Sandbox Code Playgroud)
谢谢
function paintIt()
{
color = prompt("Enter the color you want on the Background???");
document.body.style.backgroundColor = color;
}
Run Code Online (Sandbox Code Playgroud)
尝试像#000000或#fff.
| 归档时间: |
|
| 查看次数: |
16680 次 |
| 最近记录: |