「PHP入門」PHPの一般的alert関数

phpコード:
Function Alert($Str,$Typ="back",$TopWindow="",$Tim=100){
Echo “<script>".Chr(10);
If(!Empty($Str)){
Echo “alert(\"警告:\\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.".history.go(-1);".Chr(10);
Break;
Case “reload":
Echo $WinName.".window.location.reload();".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);

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);
}
Echo “</script>".Chr(10);
Exit();
}

Development

Posted by arkgame