web开发,求思路。
网页右下角的小广告怎么做的,广告是否弹出需要根据查询数据库中表的一个字段确定。我现在思路是界面加载时候发送个ajax请求,去数据库中查询字段值,判断是否弹出小广告。完事那个小广告界面一点点升起就不会写了。这个小广告要咋写?求大神指点一下。还是我思路有错误的地方也可指点下,不胜感激。如果能给个小例子,就更好了。 java javaweb
[解决办法]
<body onresize="changeSize()">
<div id="popup" style="background:#DDFFFF; display: block;bottom: 3px;right: 4px;z-index: 1000; position: fixed;width: 150px; height:120px; ">
弹出内容
</div>
</body>
<script type="text/javascript">
var oPopup = document.getElementById('popup');
var popTop=10;
var winHeight = 0;
var winWidth = 0;
var wdleft = 0;
var wdtop = 0;
function popshow(){
wdleft = window.self.screenLeft;
wdtop = window.self.screenTop;
if(popTop<180){
if (document.documentElement && document.documentElement.clientHeight && document.documentElement.clientWidth) {
winHeight = document.documentElement.clientHeight;
winWidth = document.documentElement.clientWidth;
}
oPopup.style.posLeft=winWidth -150;
oPopup.style.posTop=winHeight;
}else if(popTop<220){
wdleft = window.self.screenLeft;
wdtop = window.self.screenTop;
if (document.documentElement && document.documentElement.clientHeight && document.documentElement.clientWidth) {
winHeight = document.documentElement.clientHeight;
winWidth = document.documentElement.clientWidth;
}
oPopup.style.posLeft=winWidth -150;
oPopup.style.posTop=winHeight - popTop + 90;
}else if(popTop<220){
}
popTop+=10;
var mytime=setTimeout("popshow();",50);
}
popshow();
function changeSize() {
if (document.documentElement && document.documentElement.clientHeight && document.documentElement.clientWidth) {
winHeight = document.documentElement.clientHeight;
winWidth = document.documentElement.clientWidth;
}
oPopup.style.posLeft=winWidth - 150;
oPopup.style.posTop=winHeight- 120;
}
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>右下角弹出框</title>
</head>
<style type="text/css">
#rbbox{position:absolute;right:0;bottom:0;width:300px;height:0px;overflow:hidden}
.button{display:inline;float:right;font-size:12px;cursor:pointer}
</style>
<body><div id="rbbox"><a class="button" onclick="closeBox()">关闭</a><iframe src="http://www.kanshule.com" frameborder="0" height="200" width="300" scrolling="no"></iframe></div>
</body>
</html>
<script language="javascript" type="text/javascript">
window.onload=function(){showBox();setTimeout("closeBox()",5000)}
function showBox(o){
if (o==undefined) o=document.getElementById("rbbox");
o.style.height=o.clientHeight+2+"px";
if (o.clientHeight<200) setTimeout(function(){showBox(o)},5);
}
function closeBox(){document.getElementById("rbbox").style.display="none";}
</script>