web开发,求思路。

tuyry 2013-11-21 04:44:22
网页右下角的小广告怎么做的,广告是否弹出需要根据查询数据库中表的一个字段确定。我现在思路是界面加载时候发送个ajax请求,去数据库中查询字段值,判断是否弹出小广告。完事那个小广告界面一点点升起就不会写了。这个小广告要咋写?求大神指点一下。还是我思路有错误的地方也可指点下,不胜感激。如果能给个小例子,就更好了。
...全文
242 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
teemai 2013-11-22
  • 打赏
  • 举报
回复

 
<!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> 


翘班党 2013-11-22
  • 打赏
  • 举报
回复

<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>
tuyry 2013-11-22
  • 打赏
  • 举报
回复
引用 1 楼 ZuxiangHuang 的回复:
最土的办法,修改div的top. 比如div高是100,那么每次你觉得要上升多少(n)好, 就 100 / n 次循环,循环里,div的top -= n;
有木有什么小例子。
tony4geek 2013-11-21
  • 打赏
  • 举报
回复
这个是js 小广告
zuxianghuang 2013-11-21
  • 打赏
  • 举报
回复
最土的办法,修改div的top. 比如div高是100,那么每次你觉得要上升多少(n)好, 就 100 / n 次循环,循环里,div的top -= n;

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧