如果变量为真,我会打开一个弹出窗口。我使用了这个脚本,但不起作用
echo "<script type=\"text/javascript\">
function doStuffRegister() {
$( "#popupBasic2" ).popup( 'open');
}
</script>";
// ... my code ...
if(!$_SESSION[page][admin]) {
echo "<a href=\"#popupBasic2\" data-rel=\"popup\" data-role=\"button\">click and Open popup</a>"; // this runs
} else {
echo("<script>doStuffRegister();</script>"); // this not runs
}
//... my code ....
echo "<div data-role=\"popup\" id=\"popupBasic2\" class=\"formpopup\" >"
."<a href=\"#home\" data-rel=\"back\" data-role=\"button\" data-theme=\"a\" data-icon=\"delete\" data-iconpos=\"notext\" class=\"ui-btn-right\">Close</a>"
// ."... my html code ..."
."</div>";
有小费吗?