こういうのを自分で見つけれたらよいのですが、
JavaScript
1<!DOCTYPE html> 2<html lang="ja"> 3<head> 4 <meta charset="UTF-8"> 5 <title>Document</title> 6</head> 7<body> 8 <script type="text/javascript"> 9 col[0]="red"; 10 col[1]="blue"; 11 col[2]="yellow"; 12 col[3]="green"; 13 col[4]="pink"; 14 col[5]="brown"; 15 col[6]="gray"; 16 n=Math.floor(Math.random()*col.length); 17 document.bgcolor=col[n]; 18 </script> 19背景色が変わります。 20</body> 21</html>
type="text/javascript"って必要ですか?
不要ですか?
‐ーーーーーーーーーーーーーーーーーーーーー
col=new Array();を記述してないですね。
記述しても動作しません。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2015/11/13 23:26