我想要一个包含数据库中单词及其含义的表,在另一列中,我想为每一行设置复选框,该用户将检查它们并显示他/她知道的单词。在这种情况下我有两个问题:1-我如何隐藏第一个含义,然后单击显示含义可见它们?2-如何设置复选框?到目前为止我有这个代码,但它不起作用,如果可以的话请帮助我
<script type="text/javascript">
function ShowMeanings(){
document.getElementsByClassName('hiding').item(0).style.visiblility = 'visible';
}
</script>
<?php
$con = mysql_connect("localhost", "root", "")
or die(mysql_error());
if (!$con) {
die('Could not connect to MySQL: ' . mysql_error());
}
mysql_select_db("project", $con)
or die(mysql_error());
$result = mysql_query("select * from words");
echo "<table border='1'>
<tr>
<th>word</th>
<th>meaning</th>
<th>check</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['word'] . "</td>";
echo "<td>";
echo "<div";
echo "class='hiding' style='visibility:hidden'>" . $row['meaninig'];
echo "</div>";
echo "</td>";
echo "<td>";
echo "<input";
echo "type= 'checkbox' name = 'checkbox' id = 'checkbox' value = '' />";
echo "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($con);
?>
</div>
<button onclick="ShowMeanings()">showmeaning</button>