Javascript无法运行表单的幻灯片效果
Hoping somebody can help me with an issue im having. I cant run my slide function on a drop down form when calling it from another page.
I have an admin.php page which includes a isAdmin.php file to check if the user is an admin user. If not it redirects them to the index.php page. I would then like to call my slide function so that the login form slides down into view but the command isnt working.
Code is..
isAdmin:
if(!isAdmin())
{
header('Location: ../index.php?status=3');
//Login page should slide down for user to see the status message but function is not working correctly
echo '<script> $(document).ready(function (){ $("div#panel").slideDown("slow"); });</script> ';
}
When the login form tab is clicked this is the function that runs (this works fine):
$(function() {
$("#login").click(function(e) {
//e.preventDefault(); - Stops the page scrolling to the top
$("div#panel").slideDown("slow");
$("#toggle a").toggle();
});
});
希望有人可以帮我解决一个问题。 从另一个页面调用时,我无法在下拉表单上运行我的幻灯片功能。 p>
我有一个admin.php页面,其中包含一个isAdmin.php文件,用于检查用户是否为 管理员用户。 如果没有,它会将它们重定向到index.php页面。 然后我想调用我的幻灯片功能,以便登录表单向下滑入视图,但命令不起作用。 p>
代码是...... p>
isAdmin: p>
if(!isAdmin())
{
header('Location:../ index.php?status = 3');
//登录页面应向下滑动,以便用户查看状态消息,但功能无法正常工作
echo'&lt; script&gt; $(document).ready(function(){$(“div#panel”)。slideDown(“slow”);});&lt; / script&gt; ';
}
code> pre>
单击登录表单选项卡时,这是运行的函数(这很正常): p>
$(function(){
$(“#login”)。click(function(e){
//e.preventDefault(); - 停止页面滚动到顶部
$( “div#panel”)。slideDown(“slow”);
$(“#toggle a”)。toggle();
});
});
code> pre> \ n div>
(If I understood). Delete echo
after redirect:
if(!isAdmin()) {
header('Location: ../index.php?status=3');
//Login page should slide down for user to see the status message but
exit;
}
Change `index.php':
<?php if ( (isset($_GET['status']) && ($_GET['status']=='3')):?>
<script> $(document).ready(function (){ $("div#panel").slideDown("slow"); });</script>
<? endif;?>