| 发表于:2007-08-11 19:53:05 楼主 |
目前我的问题是这样的:一般大型的网站首页左右两边都有对联广告,现在我想通过后台数据库中调用广告列表,来显示这个广告,而不是简单的修改广告的名称!也就 是首页看到的广告是动态可以提交的!随着用户的上传而决定这个广告的内容!我的网站首是静态生成的后辍名为index.html, 代码如下: <html> <head> <title> 网站首页 </title> <meta http-equiv= "content-type " content= "text/html; charset=gb2312 "> <body> </body> </html> 而我的对联广告显示是float.asp文件如: <!--#include file= "../incfiles/conn.asp "--> 这个包含文件是链接数据库文件 <script language= "javascript "> <%set rsad=server.createobject( "adodb.recordset ") rsad.open "select top 1 * from r_ad_list left join r_ad_sort on (r_ad_list.a_sortid=r_ad_sort.id) where r_ad_sort.id=16 and a_typeid=1 ",conn,1,1 %> var delta=0.8; var collection; var closeb=false; function floaters() { this.items = []; this.additem = function(id,x,y,content) { document.write( ' <div id= '+id+ ' style= "z-index: 10; position: absolute; width:80px; height:60px;left: '+ (typeof(x)== 'string '?eval(x):x)+ ';top: '+(typeof(y)== 'string '?eval(y):y)+ ' "> '+content+ ' </div> '); var newitem = {}; newitem.object = document.getelementbyid(id); newitem.x = x; newitem.y = y; this.items[this.items.length] = newitem; } this.play = function() { collection = this.items setinterval( 'play() ',30); } } function play() { if(screen.width <=800 ¦ ¦ closeb) { for(var i=0;i <collection.length;i++) { collection[i].object.style.display = 'none '; } return; } for(var i=0;i <collection.length;i++) { var followobj = collection[i].object; var followobj_x = (typeof(collection[i].x)== 'string '?eval(collection[i].x):collection[i].x); var followobj_y = (typeof(collection[i].y)== 'string '?eval(collection[i].y):collection[i].y); if(followobj.offsetleft!=(document.body.scrollleft+followobj_x)) { var dx=(document.body.scrollleft+followobj_x-followobj.offsetleft)*delta; dx=(dx> 0?1:-1)*math.ceil(math.abs(dx)); followobj.style.left=followobj.offsetleft+dx; } if(followobj.offsettop!=(document.body.scrolltop+followobj_y)) { var dy=(document.body.scrolltop+followobj_y-followobj.offsettop)*delta; dy=(dy> 0?1:-1)*math.ceil(math.abs(dy)); followobj.style.top=followobj.offsettop+dy; } followobj.style.display = ' '; } } function closebanner() { closeb=true; return; } var thefloaters = new floaters(); thefloaters.additem( 'followdiv1 ', 'document.body.clientwidth-106 ',0, ' <a href= <%=rsad( "a_website ")%> > <img src=../ad/ad/ <%=rsad( "a_pic ")%> width=100 height=215 border=0> </a> '); thefloaters.additem( 'followdiv2 ',6,0, ' <a href= <%=rsad( "a_website ")%> > <img src=../ad/ad/ <%=rsad( "a_pic ")%> width=100 height=215 border=0> </a> '); thefloaters.play(); document.write ( " "+thefloaters+ " ") <% rsad.close:set rsad=nothing %> </script> 我先在就是无法实现这个对联广告在首页的包含,如果不使用后台数据库表中的数据调用,直接用一个实实在在的动画或图片做为对联广告,那么就可以直接将这些代码放 进去,能正常!但目前就是不能实现从静态页面中调用,有朋友也告诉我用框架去包含如: <iframe scrolling= "no " frameborder= "0 " height= " " width= " " src= "float.asp "> </iframe> 但还是没用只是在首页最上方有个空白处,去无法实现窗口的左右分列排!这个问题我也问了好多qq群中的asp相关人员,但都没有解决,所以最后我想到了中国it技术交 流社区,希望有高手在此能帮我解决这个问题!前提是我的首页必须是静态生成的,如果有更好的解决方案请与我联系:qq:361796232 在此感谢大家的帮助!谢谢 |
|
|
|
|