显示点击隐藏信息

时间:2018-02-13 10:11:14

标签: javascript php sqlite

您好,我是一年级学生,我想创建显示活动的网站,用户可以点击其他信息显示,但我无法让它工作。     

$query = $pdo->query("SELECT*from Elections");

while ($row = $query->fetch(PDO::FETCH_ASSOC)){

    echo htmlentities($row['Event']);
      echo str_repeat(" ", 20);  

    echo '<div id="hide">';
    <script type="text/javascript">document.getElementById('hide').style.display = 'none';

    echo htmlentities($row['InfoEvent']);
        echo str_repeat("&nbsp;", 20); 

    echo htmlentities($row['Month']);

        echo str_repeat("&nbsp;", 20); 

    echo htmlentities($row['Postcode']);
        echo str_repeat("&nbsp;", 20); 

    echo '<br>';
回声''; 当显示出意外的'&lt;'

时,我会收到错误

1 个答案:

答案 0 :(得分:0)

替换

 <script type="text/javascript">document.getElementById('hide').style.display = 'none';

使用

echo ('<script type="text/javascript">document.getElementById("hide").style.display = "none";</script>');
相关问题