大佬教程收集整理的这篇文章主要介绍了协调显示/隐藏JQuery脚本到PHP,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
以下是我的PHP脚本:
while($result = MysqLi_fetch_array($iName)) { echo "<b>Event Name:</b> " .$result['EventName']; echo "<br> "; echo "<b>LOCATIOn:</b> ".$result['LOCATIOn']; echo "<br>"; //this is where I would like to add my two buttons,that would show the "hidden" content when clicked
以下是我在HTML脚本中编写的内容,我想调和到PHP输出中:
<!DOCTYPE html> <html> <head> <scriptsrc="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js></script> <script> $(document).ready(function(){ $("#hidden").hide(); $("#hide").click(function(){ $("#hidden").hide(500); }); $("#show").click(function(){ $("#hidden").show(500); }); }); </script> </head> <body> <button id="show">Show</button> <button id="hide">Hide</button> <p id="hidden"> Some Random Text that will be shown when the buttons are clicked </p> </body> </html>
有关如何做到这一点的任何建议?
$counter = 1; $theClass=""; while($result = MysqLi_fetch_array($iName)) { if ($counter == MysqL_num_rows($result);){ $theClass="showHide"; } echo "<div class='$theClass'>"; echo "<b>Event Name:</b> " .$result['EventName']; echo "<br> "; echo "<b>LOCATIOn:</b> ".$result['LOCATIOn']; echo "<br>"; echo "</div> $counter++; }
然后,将您的javascript应用于其class =“showHide”的div
以上是大佬教程为你收集整理的协调显示/隐藏JQuery脚本到PHP全部内容,希望文章能够帮你解决协调显示/隐藏JQuery脚本到PHP所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。