我试图每0.28秒使块消失。做一个拼图猜谜游戏。 我已经制定了时间栏,但我无法通过使用Javascript来弄清楚如何让它变得不可见。
这是我的HTML代码:
<!DOCTYPE HTML>
<head>
<!-- Styles -->
<link href="styles/game.css" rel="stylesheet" type="text/css" media="screen" title="stylesheet" />
<!-- Title -->
<title> Raad de foto </title>
<!-- Scripts -->
<script src="../scripts/progressBar.js"></script>
<?php
$score = 0;
$level = 1; //Start level = 1
$maxLevels = 5;
$buttonColors = array("#1F5C99", "yellow", "red", "green");
$buttonName = array("Wesley Sneijder", "Ron Vlaar", "Patrick van Aanholt", "Robin van Persie");
?>
</head>
<body>
<div id="background">
<div id="image">
<!-- Top bar with text -->
<div id="headerbar">
<p class="left"> Raad De Speler </p>
<p class="middle"> <?php echo $level ?> / <?php echo $maxLevels ?> </p>
<p class="right"> Score : <?php echo $score ?></p>
</div>
<!-- img word afhankelijk van het "level" dat je bent -->
<img src="../images/<?php echo $level ?>.jpg"></img> <!-- <img src="../images/<?php echo $level; ?>.jpg"></img> -->
<div id="blocks">
<!-- Draw the blocks with logo? -->
<?php
$i=0;
while ($i<36){
?>
<img id="<?php echo $i ?>" class="image" src="../images/block.jpg"></img>
<?php $i=$i+1; } ?>
</div>
</div>
<div id="bottom">
<div class="timebar" >
<div id="timebar" ></div>
</div>
<div id="votebuttons">
<!-- Set the buttons -->
<?php
$i=0;
while ($i<4){
?>
<input style="background-color: <?php echo $buttonColors[$i]; ?>" type="submit" value="<?php echo $buttonName[$i]; ?>">
<?php $i=$i+1; } ?>
</div>
</div>
</div>
<!-- Scripts -->
<script src="../scripts/progressBar2.js"></script>
</body>
提前致谢!!
答案 0 :(得分:1)
document.getElementById(<id>).style["visibility"] = "hidden"
应该这样做。