代码中创建一个DIV层
大家好
刚看到一个JS代码.他现在只是能弹出一个图层对话框出来.现在想把他改成同时弹出两个图层.对话框为前景. 另外一个图层为背景.这样出来的效果就会很好看些.
不废话了.上代码
JS代码
=========================================================
<script>
window.addEvent('domready',function(){
var curLH = location.href;
if(["-?loginBuy\.html"].some(function(r){
return curLH.test(new RegExp(r));
})){return false;}
var MiniPassport = new Object();
var miniPassportDialog = new Element('div',{'class':'dialog mini-passport-dialog','id':'dialog1'}).set('html',$E('#template-modal .dialog').get('html').substitute({
title:'登录',
content:''
})).setStyles({
display:'none',
width:0,
height:'auto'
}).adopt(new Element('iframe',{src:'javascript:void(0);',styles:{position:'absolute',
zIndex:-1,
border:'none',
top:0,
left:0,
'filter':'alpha(opacity=0)'
},width:'100%',height:'100%'})).inject(document.body);
var mpdSize = {
loginBuy:{width:570},
};
$extend(MiniPassport,{
show:function(from,options){
var handle = this.handle = from;
options = this.options = options ||{};
var remoteURL = options.remoteURL||(handle?handle.get('href'):false);
var act ="login";
act = remoteURL.match(/-([^-]*?)\.html/)[1];
if(miniPassportDialog.style.display=='none'){
var _styles = {display:'block'};
miniPassportDialog.setStyles(_styles);
}
miniPassportDialog.getElement('.dialog-content').empty();
var fxValue = mpdSize[act];
fxValue.opacity = 1;
miniPassportDialog.setStyles(fxValue).amongTo(window);
// if(window.ie6) remoteURL=(remoteURL.substring(0,4)=='http')?remoteURL:remoteURL;
$pick(this.request,{cancel:$empty}).cancel();
this.request = new Request.HTML({update:miniPassportDialog.getElement('.dialog-content').set('html',' 正在加载...'),onComplete:function(){
MiniPassport.onload.call(MiniPassport);
}}).get(remoteURL,$H({mini_passport:1}));
},