PHP 中用JAVA script中的Confirm,为什么页面背景变成白板?
想在点击 "确定 "时,去别的页面做一个删除动作,可是还没有点击确定,背景已经成白色(弹出确认框时已经是白板了)
echo " <script language= 'javascript '> ";
echo "var record_id = '$record_id '; ";
echo "if(window.confirm( 'Delete files failed? ') == true) ";
echo "{ ";
echo "urlString= 'deleteUser.php?recordId= '; ";
echo "urlString+=record_id; ";
echo "window.location.href=urlString; ";
echo "} ";
------解决方案--------------------你的js好像都没完成。
白板是什么意思?这段js前本来就没输出当然是空白的。
看看下面是不是你要的。
echo < < <EOF
<script language= 'javascript '>
var record_id = '{$record_id} ';
if( false !== confirm( 'Delete files failed? ') )
{
urlString= 'deleteUser.php?recordId= ';
urlString+=record_id;
window.location.href=urlString;
}
</script>
EOF;