php使⽤alert,php中alert函数的⽤法PHP实现通⽤alert函数的⽅法。分享给⼤家供⼤家参考。具体如下:
函数:通⽤提⽰(推荐学习:PHP视频教程)
参数:提⽰信息,类型或⽹址,窗⼝名或函数名,延时毫秒Alert("","function","close2",300);
代码如下:function Alert($Str,$Typ="back",$TopWindow="",$Tim=100){
echo "
if(!empty($Str)){
echo "alert(\"Warning:\\n\\n{$Str}\\n\\n\");".chr(10);
}
echo "function _r_r_(){";
$WinName=(!empty($TopWindow))?"top":"self";
switch (StrToLower($Typ)){
case "#":
break;
case "back":
echo $WinName.".(-1);".chr(10);
break;
case "reload":
echo $WinName.".load();".chr(10);
break;
case "close":
echo "window.opener=null;window.close();".chr(10);
break;
case "function":
echo "var _T=new function('return {$TopWindow}')();_T();".chr(10);
break;
//Die();
Default:
if($Typ!=""){
//echo "window.{$WinName}.location.href='{$Typ}';"; echo "window.{$WinName}.location=('{$Typ}');";
}
}
echo "}".chr(10);
//為防⽌Firefox不執⾏setTimeout
echo "if(setTimeout(\"_r_r_()\",".$Tim.")==2){_r_r_();}"; if($Tim==100){
echo "_r_r_();".chr(10);
}else{
echo "setTimeout(\"_r_r_()\",".$Tim.");".chr(10);
php延时函数}
echo "".chr(10);
Exit();
}

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。