<script type= "text/javascript " language= "javascript " >
//more javascript from http://www.smallrain.net
function sAlert(str){
var msgw,msgh,bordercolor;
msgw=400;//提示窗口的宽度
msgh=100;//提示窗口的高度
titleheight=25 //提示窗口标题高度
bordercolor= "#c51100 ";//提示窗口的边框颜色
titlecolor= "#c51100 ";//提示窗口的标题颜色var sWidth,sHeight;
sWidth=screen.width;
sHeight=screen.height;var bgObj=document.createElement( "div ");
bgObj.setAttribute( 'id ', 'bgDiv ');
bgObj.style.position= "absolute ";
bgObj.style.top= "0 ";
bgObj.style.background= "#cccccc ";
bgObj.style.filter= "progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75 ";
bgObj.style.opacity= "0.6 ";
bgObj.style.left= "0 ";
bgObj.style.width=sWidth + "px ";
bgObj.style.height=sHeight + "px ";
bgObj.style.zIndex = "10000 ";
document.body.appendChild(bgObj);var msgObj=document.createElement( "div ")
msgObj.setAttribute( "id ", "msgDiv ");
msgObj.setAttribute( "align ", "center ");
msgObj.style.background= "white ";
msgObj.style.border= "1px solid " + bordercolor;
msgObj.style.position = "absolute ";
msgObj.style.left = "50% ";
msgObj.style.top = "50% ";
msgObj.style.font= "12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif ";
msgObj.style.marginLeft = "-225px " ;
msgObj.style.marginTop = -75+document.documentElement.scrollTop+ "px ";
msgObj.style.width = msgw + "px ";
msgObj.style.height =msgh + "px ";
msgObj.style.textAlign = "center ";
msgObj.style.lineHeight = "25px ";
msgObj.style.zIndex = "10001 "; var title=document.createElement( "h4 ");
title.setAttribute( "id ", "msgTitle ");
title.setAttribute( "align ", "right ");
title.style.margin= "0 ";
title.style.padding= "3px ";
title.style.background=bordercolor;
title.style.filter= "progid:DXImageTransform.Microsoft.Alpha(startX=20, startY=20, finishX=100, finishY=100,style=1,opacity=75,finishOpacity=100); ";
title.style.opacity= "0.75 ";
title.style.border= "1px solid " + bordercolor;
title.style.height= "18px ";
title.style.font= "12px Verdana, Geneva, Arial, Helvetica, sans-serif ";
title.style.color= "white ";
title.style.cursor= "pointer ";
title.innerHTML= "关闭 ";
title.onclick=function(){
document.body.removeChild(bgObj);
document.getElementById( "msgDiv ").removeChild(title);
document.body.removeChild(msgObj);
}
document.body.appendChild(msgObj);
document.getElementById( "msgDiv ").appendChild(title);
var txt=document.createElement( "p ");
txt.style.margin= "1em 0 "
txt.setAttribute( "id ", "msgTxt ");
txt.innerHTML=str;
document.getElementById( "msgDiv ").appendChild(txt);
}
</script >
<input type= "button " value= "点击这里 " onClick= "sAlert( 'test弹窗效果 '); " / >
//more javascript from http://www.smallrain.net
function sAlert(str){
var msgw,msgh,bordercolor;
msgw=400;//提示窗口的宽度
msgh=100;//提示窗口的高度
titleheight=25 //提示窗口标题高度
bordercolor= "#c51100 ";//提示窗口的边框颜色
titlecolor= "#c51100 ";//提示窗口的标题颜色var sWidth,sHeight;
sWidth=screen.width;
sHeight=screen.height;var bgObj=document.createElement( "div ");
bgObj.setAttribute( 'id ', 'bgDiv ');
bgObj.style.position= "absolute ";
bgObj.style.top= "0 ";
bgObj.style.background= "#cccccc ";
bgObj.style.filter= "progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75 ";
bgObj.style.opacity= "0.6 ";
bgObj.style.left= "0 ";
bgObj.style.width=sWidth + "px ";
bgObj.style.height=sHeight + "px ";
bgObj.style.zIndex = "10000 ";
document.body.appendChild(bgObj);var msgObj=document.createElement( "div ")
msgObj.setAttribute( "id ", "msgDiv ");
msgObj.setAttribute( "align ", "center ");
msgObj.style.background= "white ";
msgObj.style.border= "1px solid " + bordercolor;
msgObj.style.position = "absolute ";
msgObj.style.left = "50% ";
msgObj.style.top = "50% ";
msgObj.style.font= "12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif ";
msgObj.style.marginLeft = "-225px " ;
msgObj.style.marginTop = -75+document.documentElement.scrollTop+ "px ";
msgObj.style.width = msgw + "px ";
msgObj.style.height =msgh + "px ";
msgObj.style.textAlign = "center ";
msgObj.style.lineHeight = "25px ";
msgObj.style.zIndex = "10001 "; var title=document.createElement( "h4 ");
title.setAttribute( "id ", "msgTitle ");
title.setAttribute( "align ", "right ");
title.style.margin= "0 ";
title.style.padding= "3px ";
title.style.background=bordercolor;
title.style.filter= "progid:DXImageTransform.Microsoft.Alpha(startX=20, startY=20, finishX=100, finishY=100,style=1,opacity=75,finishOpacity=100); ";
title.style.opacity= "0.75 ";
title.style.border= "1px solid " + bordercolor;
title.style.height= "18px ";
title.style.font= "12px Verdana, Geneva, Arial, Helvetica, sans-serif ";
title.style.color= "white ";
title.style.cursor= "pointer ";
title.innerHTML= "关闭 ";
title.onclick=function(){
document.body.removeChild(bgObj);
document.getElementById( "msgDiv ").removeChild(title);
document.body.removeChild(msgObj);
}
document.body.appendChild(msgObj);
document.getElementById( "msgDiv ").appendChild(title);
var txt=document.createElement( "p ");
txt.style.margin= "1em 0 "
txt.setAttribute( "id ", "msgTxt ");
txt.innerHTML=str;
document.getElementById( "msgDiv ").appendChild(txt);
}
</script >
<input type= "button " value= "点击这里 " onClick= "sAlert( 'test弹窗效果 '); " / >
解决方案 »
- 如果把传递的参数改为多个?帮帮改下,谢谢.
- number(m,n)类型如何验证?
- 如何实现这样的一个三级的菜单功能.
- 怎么设置iframe滚动条的位置?
- 关于document.execCommand('InsertImage', false, imagePath)请指点小弟迷津
- 天猫的颜色选择效果怎么
- 用的VBScript 。 做发信的时候出错。 内有详细代码。 谁能指出原因 ??? 多谢多谢
- 大侠们,列一下好的过程方法:(校验字符串中的非法字符,并用特定字符替换他)
- 如何在html中引用javascript变量
- 关于网页中的iframe问题
- 如何获得上个月?
- 类似csdn这个论坛的列表的js特效是在怎样做的
>>我有问题要提问的:
1.如果我要在这个层里面进行一些业务处理(就像口碑网的那样!),我该怎么做呢?
2.层里面的数据是动态的(比如:就到数据库查出来的),我该怎么显示到层里面?
3.如果获取到了数据.是不是也是一层层的创建,再appendChild(...)?感觉这样做的话,写的代码很多,不划算.
4.我看了口碑网的那个,看不懂...
5.口碑网的那个好像是用一个页面做的,我想他的数据就是在那个页面获得的.
6.http://www.koubei.com/city/include/change_city.jsp.这个就是他的页面.
7.我怎么看也看懂他是怎么调用的.
http://image1.koubei.com/js/popupdialogbox.js
用的这个调用
<span>[<a id="topSelectCity" href="http://www.koubei.com/city/include/change_city.jsp" onmouseover="showChangeCity();" onclick="return false" onmouseout="hiddenChangeCity()">切换城市</a>]</span>
剩下的你自己研究一下
<script>
function showChangeCity(){
document.getElementById("ChangeCity").style.display= "block";
if(navigator.appName=="Microsoft Internet Explorer"){ var pageOption=document.getElementsByTagName("select");
for(var i=0;i<pageOption.length;i++){
pageOption[i].style.visibility = "hidden";
}
}
}
function hiddenChangeCity() {
if(navigator.appName=="Microsoft Internet Explorer"){ var pageOption=document.getElementsByTagName("select");
for(var i=0;i<pageOption.length;i++){
pageOption[i].style.visibility = "visible";
}
}
document.getElementById("ChangeCity").style.display = "none";
} var theUrl = document.location.href;
var reg=Array(/store/,/fang/,/cate/,/fenlei/);
for(var i=0;i<4;i++){
var regResult=theUrl.match(reg[i]);
if(regResult!=null){
var channelSelect=regResult[0];
}
}
if(channelSelect==undefined){
channelSelect="";
}
arrHref=document.getElementById('ChangeCity').getElementsByTagName('tbody')[0].getElementsByTagName('a');
for(var i=0;i<arrHref.length;i++){
var tempHref=arrHref[i].href;
arrHref[i].href=tempHref + channelSelect;
}
document.getElementById("OpenUrl").href="javascript:popdialog.openWithIframe('选择城市','http://www.koubei.com/city/selectcitymore.html?city=1805&channel="+channelSelect+"',620,500,true);";
document.getElementById("topSelectCity").href="javascript:popdialog.openWithIframe('选择城市','http://www.koubei.com/city/selectcitymore.html?city=1805&channel="+channelSelect+"',620,500,true);";
</script>