我有这个功能,通过单击“+显示更多”或“ - 隐藏”按钮来显示和隐藏容器,具体取决于当前操作。然而,它不起作用。任何有关原因的见解?
singleInstance
功能:
echo ' <br>
<a href="employees.php" style="display:inline-block;"><img src="../img/back.png" /></a><br>
<button type="button" onclick="show_hide("pinfocontainer","hidepinfo");" class="sidebutton" id="hidepinfo">+ Show more</button>
<div class="hide" id="pinfocontainer">
<div class="editform">
<h1>Personal Info </h1>
<br>
<form action="" method="post">
<span></span>';
$sql = "SHOW COLUMNS FROM candidates";
$result = mysqli_query($con,$sql);
while($row = mysqli_fetch_array($result)){
$sql2 = "SELECT ".$row['Field']." FROM candidates WHERE ID='".$_GET["cid"]."'";
$result2 = mysqli_query($con,$sql2);
echo '<label class="editlabel"> '.$row['Field'].' : </label>';
while($row2 = mysqli_fetch_array($result2)){
echo '<input class="editinput" id="'.$row['Field'].'" name="'.$row['Field'].'" value="'.$row2[$row['Field']].'" type="text">';
}
echo '<br>';
}
echo '<input name="submit" type="submit" value=" Update " style="width:105%;">
<span></span>
</form>
</div>
</div>
<div style="display:inline-block;padding-left:15px;padding-right:15px;"> </div>
答案 0 :(得分:4)
onclick="show_hide("pinfocontainer","hidepinfo");"
您使用第2个&#34;关闭属性所以改变&#34;到&#39;
onclick="show_hide('pinfocontainer','hidepinfo');"
你可以逃避&#39;因为你回应它
echo 'onclick="show_hide(\'pinfocontainer\',\'hidepinfo\');"';