首页 > Other > PHP通用alert函数

PHP通用alert函数

//函数:通用提示
//参数:提示息,型或址,窗口名或函得延时毫秒Alert(“”,”function”,”close2″,300);

//函数:通用提示
//参数:提示息,型或址,窗口名或函得延时毫秒Alert(“”,”function”,”close2″,300);
Function Alert($Str,$Typ=”back”,$TopWindow=””,$Tim=100){
Echo “<script>”.Chr(10);
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.”.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);

//榉乐irefox不绦etTimeout
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();
}

分类:Other
  1. 还没有评论。
  1. No trackbacks yet.

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s

%d 博主赞过: