我想要的是这样的:隐藏按钮,如果不是管理员
如果不是管理员,然后隐藏一些按钮。但如果我做
if ($Admin == null)
{
echo "You are not admin"; //That works
//So we hide the button id="New"
?>
<script type = "text/javascript">
document.getElementById('New').style.visibility = "hidden";
</script>
<?php } ?>
但没有任何反应。它说“你不是管理员”,但按钮不隐藏
我知道如何隐藏字段通过单击按钮或选中复选框的功能,但我不知道如何通过使用“如果”如何做。 感谢您的阅读
使用的document.getElementById( '新的')的style.display = “无”; –
我建议不要只隐藏管理按钮,但不要回应他们 – gbestard
这是一个坏主意。理想情况下,按钮应该不在页面中,除非您是管理员用户。千万不要做这样的客户端。 ^^忍者! – Archer