[09-09] 本人想升级为一级站长,望管理人员批准
模仿百度弹窗的信息提示很酷(转载)
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" C>
<META NAME="Author" C>
<META NAME="Keywords" C>
<META NAME="Description" C>
<script language="javascript" src="popup.js"></script>
<script type="text/javascript">
function ShowIframe()
{
var pop=new Popup({ contentType:1,isReloadOnClose:false,width:600,height:500});
pop.setContent("contentUrl","111.htm");
pop.setContent("title","iframe框架示例");
pop.build();
pop.show();
}
function ShowHtmlString()
{
var strHtml = "<table border=1 style='width:90%; text-align:center;'><tr style='height:40px'><td>ds</td><td>dads</td></tr><tr style='height:40px'><td>dadas</td><td>dasd</td></tr><tr style='height:40px'><td>dadasd</td><td>dsadads</td></tr></table>";
var pop=new Popup({ contentType:2,isReloadOnClose:false,width:340,height:300});
pop.setContent("contentHtml",strHtml);
pop.setContent("title","html字符串示例");
pop.build();
pop.show();
}
function ShowConfirm()
{
var pop=new Popup({ contentType:3,isReloadOnClose:false,width:340,height:80});
pop.setContent("title","confirm对话框示例");
pop.setContent("confirmCon","confirm对话框的内容");
pop.setContent("callBack",ShowCallBack);
pop.setContent("parameter",{id:"divCall",str:"点击确定后显示的字符串",obj:pop});
pop.build();
pop.show();
}
function ShowAlert()
{
var pop=new Popup({ contentType:4,isReloadOnClose:false,width:340,height:80});
pop.setContent("title","alert警告框示例");
pop.setContent("alertCon","alert对话框的内容");
pop.build();
pop.show();
}
function ShowCallBack(para)
{
var o_pop = para["obj"]
var obj = document.getElementById(para["id"]);
o_pop.close();
obj.innerText = para["str"];
}
function ShowIframe_CALLBACK(r, s){
if(r == 0){
if(pop!=null)pop.close();
pop=new Popup({ contentType:2, isReloadOnClose:false, width:350, height:100 });
pop.setContent("title","添加好友");
pop.setContent("contentHtml", "<div class=\"al\">" + s + "</div>");
pop.build();
pop.show();
setTimeout(function(){location.reload(true);},2000);
}else if(r == 4){
//friendCountOverFlow();
}else if(r == 11){
//addTooMany();
}
}
</script>
</head>
<body style="text-align:center;">
<form id="form1" runat="server">
<div>
<a href="javascript:ShowIframe()">iframe框架示例</a>
<br />
<a href="javascript:ShowHtmlString()">html字符串示例</a>
<br />
<a href="javascript:ShowConfirm()">confirm对话框示例</a>
<br />
<a href="javascript:ShowAlert()">alert警告框示例</a>
</div>
<div id="divCall" style="width:300px; height:200px; background-color:#cccccc; color:Red; float:right;">
</div>
</form>
</body>
</html>
ShowIframe中的111.htm的页面是:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" C>
<META NAME="Author" C>
<META NAME="Keywords" C>
<META NAME="Description" C>
<script language="javascript">
function userclick(){
alert("chenggong");
//location.href="123.htm?r=4&callback=top.FRD_CALLBACK"
var r = 0;
var c = "top.ShowIframe_CALLBACK";
var messages = {
"r0":"操作成功!",
"r4":"您的好友数目已经达到上限!",
"r3":"您的分组数目已经达到上限!",
"r5":"您的好友数,分组数目均已经达到上限!",
"r11":"今天您添加的好友数已经达到上限,请明日再添加!",
"r12":"今天您删除的好友数已经达到上限,请明日再删除!"
}
try{
var f = eval(c);
if(f && typeof f == 'function')
f(r, (messages["r" + r] || "未知错误?"));
}catch(e){}
}
</script>
</HEAD>
<BODY>
<input type="button" value="提交">
</BODY>
</HTML