在线等,解决即送分,关于javascript和asp结合的问题。

adf3wswwe3 2005-04-04 03:01:52

<script language="JavaScript">
imgArr=new Array()
imgArr[0]="<a href=Javascript:; onmouseMove='javascript:outHover=true' onMouseover='javascript:outHover=true' onMouseout='javascript:outHover=false;mvStart()'><img src=http://www.it365cn.com/images/logo.gif border=0></a>"
imgArr[1]="<a href=Javascript:; onmouseMove='javascript:outHover=true' onMouseover='javascript:outHover=true' onMouseout='javascript:outHover=false;mvStart()'><img src=http://www.it365cn.com/images/logo_1.gif border=0></a>"
imgArr[2]="<a href=Javascript:; onmouseMove='javascript:outHover=true' onMouseover='javascript:outHover=true' onMouseout='javascript:outHover=false;mvStart()'><img src=http://www.it365cn.com/images/logo/flashfox.gif border=0></a>"
imgArr[3]="<a href=Javascript:; onmouseMove='javascript:outHover=true' onMouseover='javascript:outHover=true' onMouseout='javascript:outHover=false;mvStart()'><img src=http://www.it365cn.com/images/logo/blueieda.gif border=0></a>"
imgArr[4]="<a href=Javascript:; onmouseMove='javascript:outHover=true' onMouseover='javascript:outHover=true' onMouseout='javascript:outHover=false;mvStart()'><img src=http://www.it365cn.com/images/logo/flashempire.gif border=0></a>"
imgArr[5]="<a href=Javascript:; onmouseMove='javascript:outHover=true' onMouseover='javascript:outHover=true' onMouseout='javascript:outHover=false;mvStart()'><img src=http://www.it365cn.com/images/logo/5dmedia.gif border=0></a>"
imgArr[6]="<a href=Javascript:; onmouseMove='javascript:outHover=true' onMouseover='javascript:outHover=true' onMouseout='javascript:outHover=false;mvStart()'><img src=http://www.it365cn.com/images/logo/windstudio.gif border=0></a>"
imgArr[7]="<a href=Javascript:; onmouseMove='javascript:outHover=true' onMouseover='javascript:outHover=true' onMouseout='javascript:outHover=false;mvStart()'><img src=http://www.it365cn.com/images/logo/sucaiw.gif border=0></a>"
imgArr[8]="<a href=Javascript:; onmouseMove='javascript:outHover=true' onMouseover='javascript:outHover=true' onMouseout='javascript:outHover=false;mvStart()'><img src=http://www.it365cn.com/images/logo/htmlcn.gif border=0></a>"
imgArr[9]="<a href=Javascript:; onmouseMove='javascript:outHover=true' onMouseover='javascript:outHover=true' onMouseout='javascript:outHover=false;mvStart()'><img src=http://www.it365cn.com/images/logo/flasherclub.gif border=0></a>"
imgArr[10]="<a href=Javascript:; onmouseMove='javascript:outHover=true' onMouseover='javascript:outHover=true' onMouseout='javascript:outHover=false;mvStart()'><img src=http://www.it365cn.com/images/logo/fwcn.gif border=0></a>"
......
</script>
上面是一断script程序断,每个数组都是手工赋图片路径值的,我现在想用从数据库中读取每个文件的路径进行赋值应怎么写,应该怎么写呢?
...全文
74 6 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
hinavy 2005-04-05
  • 打赏
  • 举报
回复
gArr[0]="<a href=Javascript:; onmouseMove='javascript:outHover=true' onMouseover='javascript:outHover=true' onMouseout='javascript:outHover=false;mvStart()'><img src=<%=rs("logo_url")%> border=0></a>"

改成
gArr[<%=i%>]="<a href=Javascript:; onmouseMove='javascript:outHover=true' onMouseover='javascript:outHover=true' onMouseout='javascript:outHover=false;mvStart()'><img src=<%=rs("logo_url")%> border=0></a>"

这样试试
adf3wswwe3 2005-04-04
  • 打赏
  • 举报
回复
gArr[0]="<a href=Javascript:; onmouseMove='javascript:outHover=true' onMouseover='javascript:outHover=true' onMouseout='javascript:outHover=false;mvStart()'><img src=http://www.it365cn.com/images/logo.gif border=0></a>"

<%
set rs=conn.execute("select top 8 * from ban order by id desc")
while not rs.eof
%>

gArr[0]="<a href=Javascript:; onmouseMove='javascript:outHover=true' onMouseover='javascript:outHover=true' onMouseout='javascript:outHover=false;mvStart()'><img src=<%=rs("logo_url")%> border=0></a>"
<%
i=i+1
rs.movenext
wend
%>

------------------------------------------
我这样写不行呀!!!!!!!!!!!!!求助
adf3wswwe3 2005-04-04
  • 打赏
  • 举报
回复
<script language="JavaScript">
imgArr=new Array()
imgArr[0]="<a href=Javascript:; onmouseMove='javascript:outHover=true' onMouseover='javascript:outHover=true' onMouseout='javascript:outHover=false;mvStart()'><img src=http://www.it365cn.com/images/logo.gif border=0></a>"
imgArr[1]="<a href=Javascript:; onmouseMove='javascript:outHover=true' onMouseover='javascript:outHover=true' onMouseout='javascript:outHover=false;mvStart()'><img src=http://www.it365cn.com/images/logo_1.gif border=0></a>"
imgArr[2]="<a href=Javascript:; onmouseMove='javascript:outHover=true' onMouseover='javascript:outHover=true' onMouseout='javascript:outHover=false;mvStart()'><img src=http://www.it365cn.com/images/logo/flashfox.gif border=0></a>"
imgArr[3]="<a href=Javascript:; onmouseMove='javascript:outHover=true' onMouseover='javascript:outHover=true' onMouseout='javascript:outHover=false;mvStart()'><img src=http://www.it365cn.com/images/logo/blueieda.gif border=0></a>"
imgArr[4]="<a href=Javascript:; onmouseMove='javascript:outHover=true' onMouseover='javascript:outHover=true' onMouseout='javascript:outHover=false;mvStart()'><img src=http://www.it365cn.com/images/logo/flashempire.gif border=0></a>"
imgArr[5]="<a href=Javascript:; onmouseMove='javascript:outHover=true' onMouseover='javascript:outHover=true' onMouseout='javascript:outHover=false;mvStart()'><img src=http://www.it365cn.com/images/logo/5dmedia.gif border=0></a>"
imgArr[6]="<a href=Javascript:; onmouseMove='javascript:outHover=true' onMouseover='javascript:outHover=true' onMouseout='javascript:outHover=false;mvStart()'><img src=http://www.it365cn.com/images/logo/windstudio.gif border=0></a>"
imgArr[7]="<a href=Javascript:; onmouseMove='javascript:outHover=true' onMouseover='javascript:outHover=true' onMouseout='javascript:outHover=false;mvStart()'><img src=http://www.it365cn.com/images/logo/sucaiw.gif border=0></a>"
imgArr[8]="<a href=Javascript:; onmouseMove='javascript:outHover=true' onMouseover='javascript:outHover=true' onMouseout='javascript:outHover=false;mvStart()'><img src=http://www.it365cn.com/images/logo/htmlcn.gif border=0></a>"
imgArr[9]="<a href=Javascript:; onmouseMove='javascript:outHover=true' onMouseover='javascript:outHover=true' onMouseout='javascript:outHover=false;mvStart()'><img src=http://www.it365cn.com/images/logo/flasherclub.gif border=0></a>"
imgArr[10]="<a href=Javascript:; onmouseMove='javascript:outHover=true' onMouseover='javascript:outHover=true' onMouseout='javascript:outHover=false;mvStart()'><img src=http://www.it365cn.com/images/logo/fwcn.gif border=0></a>"
var moveStep=4 //步长,单位:pixel
var moveRelax=100 //移动时间间隔,单位:ms

ns4=(document.layers)?true:false

var displayImgAmount=4 //视区窗口可显示个数
var divWidth=88 //每块图片占位宽
var divHeight=31 //每块图片占位高

var startDnum=0
var nextDnum=startDnum+displayImgAmount
var timeID
var outHover=false

var startDivClipLeft
var nextDivClipRight

function initDivPlace(){
if (ns4){
for (i=0;i<displayImgAmount;i++){
eval("document.divOuter.document.divAds"+i+".left="+divWidth*i)
}
for (i=displayImgAmount;i<imgArr.length;i++){
eval("document.divOuter.document.divAds"+i+".left="+divWidth*displayImgAmount)
}
}else{
for (i=0;i<displayImgAmount;i++){
eval("document.all.divAds"+i+".style.left="+divWidth*i)
}
for (i=displayImgAmount;i<imgArr.length;i++){
eval("document.all.divAds"+i+".style.left="+divWidth*displayImgAmount)
}
}
}

function mvStart(){
timeID=setTimeout(moveLeftDiv,moveRelax)
}

function mvStop(){
clearTimeout(timeID)
}

function moveLeftDiv(){
if (ns4){
for (i=0;i<=displayImgAmount;i++){
eval("document.divOuter.document.divAds"+parseInt((startDnum+i)%imgArr.length)+".left=document.divOuter.document.divAds"+parseInt((startDnum+i)%imgArr.length)+".left-moveStep")
}

startDivClipLeft=parseInt(eval("document.divOuter.document.divAds"+startDnum+".clip.left"))
nextDivClipRight=parseInt(eval("document.divOuter.document.divAds"+nextDnum+".clip.right"))

if (startDivClipLeft+moveStep>divWidth){
eval("document.divOuter.document.divAds"+nextDnum+".clip.right="+divWidth)

eval("document.divOuter.document.divAds"+startDnum+".left="+divWidth*displayImgAmount)
eval("document.divOuter.document.divAds"+parseInt((nextDnum+1)%imgArr.length)+".left=document.divOuter.document.divAds"+nextDnum+".left+"+divWidth)
eval("document.divOuter.document.divAds"+parseInt((nextDnum+1)%imgArr.length)+".clip.left=0")


startDnum=(++startDnum)%imgArr.length
nextDnum=(startDnum+displayImgAmount)%imgArr.length

startDivClipLeft=moveStep-(divWidth-startDivClipLeft)
nextDivClipRight=moveStep-(divWidth-nextDivClipRight)
}else{
eval("document.divOuter.document.divAds"+nextDnum+".clip.left=0")
startDivClipLeft+=moveStep
nextDivClipRight+=moveStep
}
eval("document.divOuter.document.divAds"+startDnum+".clip.left="+startDivClipLeft)
eval("document.divOuter.document.divAds"+nextDnum+".clip.right="+nextDivClipRight)
}else{
for (i=0;i<=displayImgAmount;i++){
eval("document.all.divAds"+parseInt((startDnum+i)%imgArr.length)+".style.left=document.all.divAds"+parseInt((startDnum+i)%imgArr.length)+".style.pixelLeft-moveStep")
}

startDivClipLeft=parseInt(eval("document.all.divAds"+startDnum+".currentStyle.clipLeft"))
nextDivClipRight=parseInt(eval("document.all.divAds"+nextDnum+".currentStyle.clipRight"))

if (startDivClipLeft+moveStep>divWidth){
eval("document.all.divAds"+nextDnum+".style.clip='rect(0,"+divWidth+","+divHeight+",0"+")'")

eval("document.all.divAds"+startDnum+".style.left="+divWidth*displayImgAmount)
eval("document.all.divAds"+parseInt((nextDnum+1)%imgArr.length)+".style.left=document.all.divAds"+nextDnum+".style.pixelLeft+"+divWidth)

startDnum=(++startDnum)%imgArr.length
nextDnum=(startDnum+displayImgAmount)%imgArr.length

startDivClipLeft=moveStep-(divWidth-startDivClipLeft)
nextDivClipRight=moveStep-(divWidth-nextDivClipRight)
}else{
startDivClipLeft+=moveStep
nextDivClipRight+=moveStep
}
eval("document.all.divAds"+startDnum+".style.clip='rect(0,"+divWidth+","+divHeight+","+startDivClipLeft+")'")
eval("document.all.divAds"+nextDnum+".style.clip='rect(0,"+nextDivClipRight+","+divHeight+",0)'")
}

if (outHover){
mvStop()
}else{
mvStart()
}


}

function writeDivs(){
if (ns4){
document.write("<ilayer name=divOuter width=750 height="+divHeight+">")

for (i=0;i<imgArr.length;i++){
document.write("<layer name=divAds"+i+">")
document.write(imgArr[i]+" ")
document.write("</layer>")
}
document.write("</ilayer>")
document.close()
for (i=displayImgAmount;i<imgArr.length;i++){
eval("document.divOuter.document.divAds"+i+".clip.right=0")
}
}else{
document.write("<div id=divOuter style='position:relative' width=750 height="+divHeight+">")

for (i=0;i<imgArr.length;i++){
document.write("<div id=divAds"+i+" style='position:absolute;clip:rect(0,"+divWidth+","+divHeight+",0)'>")
document.write(imgArr[i]+" ")
document.write("</div>")
}
document.write("</div>")
for (i=displayImgAmount;i<imgArr.length;i++){
eval("document.all.divAds"+i+".style.clip='rect(0,0,"+divHeight+",0)'")
}
}
}
</script>
hinavy 2005-04-04
  • 打赏
  • 举报
回复
代码太多,眼花,取其中一段来写

gArr[0]="<a href=Javascript:; onmouseMove='javascript:outHover=true' onMouseover='javascript:outHover=true' onMouseout='javascript:outHover=false;mvStart()'><img src=http://www.it365cn.com/images/logo.gif border=0></a>"

<%
'ASP连接数据库,就写在这个JS文件里也可以的
for i=0 to 10'这里取你要显示的个数
%>
gArr[0]="<a href=Javascript:; onmouseMove='javascript:outHover=true' onMouseover='javascript:outHover=true' onMouseout='javascript:outHover=false;mvStart()'><img src=<%=rs("logo_url")%> border=0></a>"
<%
next
rs.movenext
%>
wren135 2005-04-04
  • 打赏
  • 举报
回复
和在ASP 中一样
ryuginka 2005-04-04
  • 打赏
  • 举报
回复
没必要全部用JS写.

28,408

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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