超漂亮的彈出層效果

作者badcock
提取自ZCMS的彈出層,無外部css文件,引用Dialog.js即可使用,兼容主流瀏覽器,支持ie6下的陰影和半透明效果,
[b]先看效果圖[/b]
[img]http://dl.iteye.com/upload/picture/pic/44953/cc7ab7d8-ddac-337d-a705-e316c3bcfd64.png[/img]


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>【強烈推薦】 超漂亮的仿騰訊彈出層效果(兼容主流瀏覽器)</title>
<style>
body {background: #ffffff; color: #444;}
a{ color: #09d; text-decoration: none; border: 0; background-color: transparent;}
body,div,q,iframe,form,h5{ margin: 0; padding: 0;}
img,fieldset { border: none 0; }
body,td,textarea { word-break: break-all; word-wrap: break-word; line-height:1.5;}
body,input,textarea,select,button { margin: 0; font-size: 12px; font-family: Tahoma, SimSun, sans-serif;}
div,p,table,th,td { font-size:1em; font-family:inherit; line-height:inherit;}
h5{ font-size:12px;}
</style>
<script type="text/javascript" src="http://www.5-studio.com/wp-content/uploads/2009/06/Dialog.js"></script>
<script type="text/javascript">
function $(ele) {
if (typeof(ele) == 'string'){
ele = document.getElementById(ele)
if(!ele){
return null;
}
}
if(ele){
Core.attachMethod(ele);
}
return ele;
}
var Core = {};
Core.attachMethod = function(ele){
if(!ele||ele["$A"]){
return;
}
if(ele.nodeType==9){
return;
}
var win;
try{
if(isGecko){
win = ele.ownerDocument.defaultView;
}else{
win = ele.ownerDocument.parentWindow;
}
for(var prop in $E){
ele[prop] = win.$E[prop];
}
}catch(ex){
//alert("Core.attachMethod:"+ele)//有些對象不能附加屬性,如flash
}
}
function zOpenD(){
var diag = new Dialog("Diag1");
diag.Width = 900;
diag.Height = 400;
diag.Title = "彈出窗口示例";
diag.URL = "http://demo.zving.com/";
diag.ShowMessageRow = true;
diag.MessageTitle = "彈出窗口示例";
diag.Message = "在這兒你可以對這個窗口的內容或功能作一些說明";
diag.OKEvent = zAlert;//點擊確定後調用的方法
diag.show();
}
function zOpen(){
var diag = new Dialog("Diag2");
diag.Width = 900;
diag.Height = 400;
diag.Title = "彈出窗口示例";
diag.URL = "http://demo.zving.com/";
diag.OKEvent = zAlert;//點擊確定後調用的方法
diag.show();
}
function zAlert(){
Dialog.alert("濾爸要來了,河諧你,河諧我,河諧二十一世紀的新一代");
}
function zConfirm(){
Dialog.confirm('警告:您確認要XXOO嗎?',function(){Dialog.alert("yeah,週末到了,正是好時候");});
}
function sometext(ele,n){
var strArr=["可","以","清","心","也"];
var writeStr=""
for(i=0;i<n;i++){
index=parseInt(Math.random()*5);
for(j=0;j<5;j++){
str=index+j>4?index+j-5:index+j;
writeStr+=strArr[str];
}
}
$(ele).innerHTML=writeStr;
}
</script>
</head>
<body>
<div id="div1"></div>
<p>     <input type="button" value="彈出新窗口" οnclick="zOpen()" /> <input type="button" value="彈出帶說明的新窗口" οnclick="zOpenD()" /> <input type="button" value="彈出信息提示對話框" οnclick="zAlert()" /> <input type="button" value="彈出選擇對話框" οnclick="zConfirm()" /></p>
<div id="div2"></div>
<script>sometext("div1",100);sometext("div2",300);</script>
</body>
</html>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章