php内部的简单警报切换

时间:2018-05-11 20:28:47

标签: javascript php

我试图弄清楚当我点击一个按钮时,会出现一个小的对话框,显示我的php中的echo $ var信息。

我有php显示的html。我能够回应我想要的个别变量没有问题,但我想隐藏手机和电子邮件隐藏在onclick联系人按钮后面。这是我的编码知识尝试的范围:

谢谢!

while ($row = mysqli_fetch_assoc($result)) {
            echo "<section class='content'>";
            echo "<div class='section group'>";
            echo "<div class='col span_1_of_3'>";
            echo "<div class='card'>";
            echo "<h2 class='name'>";
            echo $row['Fname'] . " ";
            echo $row['Lname'];
            echo "</h2>";
            echo "<section class='profile'>";
            echo "<h3>Interests:</h3> ";
            echo $row['Interest1'] . ", ";
            echo $row['Interest2'] . ", ";
            echo $row['Interest3']  . "<br>";
            echo "<h3>Website:</h3> ";
            echo $row['Website']  . "<br>";
            echo "<h3>Personal Statement:</h3> ";
            echo "<aside class='statement'>";
            echo "<p>";
            echo $row['PersonalStatement'] . "<br><br>";
            echo "</p>";
            echo "</aside>";
            echo "<button class='contact-details' button id='contact' onclick='toggle_visibility('contact')'";
            echo "Contact";
            echo "</button>";

            echo "</section>";
            echo "</div>";
            echo "</div>";
            echo "</div>";
            echo "</body>";
            echo "</html>";
            ?>
                <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script language="javascript">
        $(document).ready(function(){
      $("#contact").click(function(){
        alert("<?php echo $row['Phone'];?>"'<br>'
        "<?php echo $row['Email'];?>");
        exit;
        });
    });
        </script>

1 个答案:

答案 0 :(得分:0)

虽然我得到了切换工作,但在美学上它并没有像我在理论上那样吸引我。我只是将内容作为标准披露。