日期:2014-05-17  浏览次数:21044 次

常用的广告代码,如何实现从数据库中取值。
<script   type= "text/javascript ">
imgUrl1= "news/1.jpg ";
imgtext1= "新闻动态1 "
imgLink1=escape( "index.html ");
imgUrl2= "news/2.jpg ";
imgtext2= "新闻动态2 "
imgLink2=escape( "index.html ");
imgUrl3= "news/3.jpg ";
imgtext3= "新闻动态3 "
imgLink3=escape( "index.html ");
imgUrl4= "news/4.jpg ";
imgtext4= "新闻动态4 "
imgLink4=escape( "index.html ");
imgUrl5= "news/5.jpg ";
imgtext5= "新闻动态5 "
imgLink5=escape( "index.html ");
var   focus_width=250
var   focus_height=160
var   text_height=18
var   swf_height=focus_height+text_height
var   pics=imgUrl1+ "| "+imgUrl2+ "| "+imgUrl3+ "| "+imgUrl4+ "| "+imgUrl5
var   links=imgLink1+ "| "+imgLink2+ "| "+imgLink3+ "| "+imgLink4+ "| "+imgLink5
var   texts=imgtext1+ "| "+imgtext2+ "| "+imgtext3+ "| "+imgtext4+ "| "+imgtext5
document.write( ' <object   classid= "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000 "   codebase= "http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0 "   width= " '+   focus_width   + ' "   height= " '+   swf_height   + ' "> ');
document.write( ' <param   name= "allowScriptAccess "   value= "sameDomain "> <param   name= "movie "   value= "img/focus2.swf "> <param   name= "quality "   value= "high "> <param   name= "bgcolor "   value= "#F0F0F0 "> ');
document.write( ' <param   name= "menu "   value= "false "> <param   name=wmode   value= "opaque "> ');
document.write( ' <param   name= "FlashVars "   value= "pics= '+pics+ '&links= '+links+ '&texts= '+texts+ '&borderwidth= '+focus_width+ '&borderheight= '+focus_height+ '&textheight= '+text_height+ ' "> ');
document.write( ' </object> '); </script>
-------------------------------------
如何将imgUrl等变量的值从数据库中取值?


------解决方案--------------------
imgUrl1= "news/1.jpg ";
imgtext1= "新闻动态1 "
imgLink1=escape( "index.html ");
imgUrl2= "news/2.jpg ";
imgtext2= "新闻动态2 "
imgLink2=escape( "index.html ");
imgUrl3= "news/3.jpg ";
imgtext3= "新闻动态3 "
imgLink3=escape( "index.html ");
imgUrl4= "news/4.jpg ";
imgtext4= "新闻动态4 "
imgLink4=escape( "index.html ");
imgUrl5= "news/5.jpg ";
imgtext5= "新闻动态5 "
imgLink5=escape( "index.html ");

这一段都去了~
改成从数据库里面读取的~

<%
Set Rs = Server.CreateObject( "ADODB.RecordSet ")
Rs.Open "Select * From [Ads_List] ",Conn,1,1
Do While Not Rs.Eof
imgUrl = imgUrl & Rs( "AL_Pic ") & "| "
imgText = imgText & Rs( "AL_Title ") & "| "
imgLink = imgLink & Rs( "AL_Link ") & "| "
Rs.MoveNext
Loop
if imgUrl <> " " then
imgUrl = Left(imgUrl,len(imgUrl) -1)
imgTex