| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1351 人关注过本帖
标题:[求助]javascript中加入asp
只看楼主 加入收藏
firemx
Rank: 1
等 级:新手上路
帖 子:26
专家分:0
注 册:2006-9-25
收藏
 问题点数:0 回复次数:17 
[求助]javascript中加入asp

我想要在的javascript中添加入asp,就是直接在代码中调用数据库中的链接,请问如何做到呢????
急急急
<!--#include file="news/conn.asp"-->
<script LANGUAGE="javascript">
<!--
var cpAD=new Array();
var cpADlink=new Array();
var cpADmsg=new Array();
var adNum=5; file://¶¨ÒåÁË5¸öÊý×é
var coll=0;
cpAD[0]="image/123.jpg"; file://Á´½ÓͼƬ
cpADlink[0]=""; file://Á´½ÓURL
cpADmsg[0]=""; file://״̬À¸ÌáʾÐÅÏ¢
cpAD[1]="image/456.jpg";
cpADlink[1]=""
cpADmsg[1]="";
cpAD[2]="image/789.jpg";
cpADlink[2]="";
cpADmsg[2]="";
cpAD[3]="image/011.jpg";
cpADlink[3]="";
cpADmsg[3]="";
cpAD[4]="image/012.jpg";
cpADlink[4]="";
cpADmsg[4]="";
var preloadedimages=new Array();
for (i=1;i<cpAD.length;i++){
preloadedimages[i]=new Image();
preloadedimages[i].src=cpAD[i];
}
file://ÌøתµÄURLµØÖ·
function jump2url()
{
jumpUrl=cpADlink[adNum];
jumpTarget='_blank';
if (jumpUrl != '')
{
if (jumpTarget != '')
window.open(jumpUrl,jumpTarget);
else location.href=jumpUrl;
}
}
file://ͼƬ±ä»¯µÄº¯Êý
function changeimg(n)
{
adNum=n;
switch(adNum)
{
case 0:
{
window.img1.src="image/1-2.gif";
window.img2.src="image/2.gif";
window.img3.src="image/3.gif";
window.img4.src="image/4.gif";
window.img5.src="image/5.gif";
break;
}
case 1:
{
window.img1.src="image/1.gif";
window.img2.src="image/2-2.gif";
window.img3.src="image/3.gif";
window.img4.src="image/4.gif";
window.img5.src="image/5.gif";
break;
}
case 2:
{
window.img1.src="image/1.gif";
window.img2.src="image/2.gif";
window.img3.src="image/3-2.gif";
window.img4.src="image/4.gif";
window.img5.src="image/5.gif";
break;
}
case 3:
{
window.img1.src="image/1.gif";
window.img2.src="image/2.gif";
window.img3.src="image/3.gif";
window.img4.src="image/4-2.gif";
window.img5.src="image/5.gif";
break;
}
case 4:
{
window.img1.src="image/1.gif";
window.img2.src="image/2.gif";
window.img3.src="image/3.gif";
window.img4.src="image/4.gif";
window.img5.src="image/5-2.gif";
break;
}
}
window.clearInterval(theTimer);
adNum=adNum-1;
nextAd();
}
file://µ±µã»÷ʱֱ½ÓÌøת
function nextAd(){
coll++;
if(coll>1)
{
switch(adNum+1)
{
case 5:
{
window.img1.src="image/1-2.gif";
window.img2.src="image/2.gif";
window.img3.src="image/3.gif";
window.img4.src="image/4.gif";
window.img5.src="image/5.gif";
break;
}
case 1:
{
window.img1.src="image/1-2.gif";
window.img2.src="image/2-2.gif";
window.img3.src="image/3.gif";
window.img4.src="image/4.gif";
window.img5.src="image/5.gif";
break;
}
case 2:
{
window.img1.src="image/1-2.gif";
window.img2.src="image/2.gif";
window.img3.src="image/3-2.gif";
window.img4.src="image/4.gif";
window.img5.src="image/5.gif";
break;
}
case 3:
{
window.img1.src="image/1-2.gif";
window.img2.src="image/2.gif";
window.img3.src="image/3.gif";
window.img4.src="image/4-2.gif";
window.img5.src="image/5.gif";
break;
}
case 4:
{
window.img1.src="image/1-2.gif";
window.img2.src="image/2.gif";
window.img3.src="image/3.gif";
window.img4.src="image/4.gif";
window.img5.src="image/5.gif";
break;
}
}
}
if(adNum<cpAD.length-1)adNum++ ;
else adNum=0;
setTransition();
document.images.cpADrush.src=cpAD[adNum];
playTransition();
displayStatusMsg();
file://¶¨ÒåÁËÂÖ»»Ê±¼ä 5s
theTimer=setTimeout("nextAd()", 5000);
}
function setTransition(){
if (document.all){
cpADrush.filters.revealTrans.Transition=23;
cpADrush.filters.revealTrans.apply();
}
}
function playTransition(){
if (document.all)
cpADrush.filters.revealTrans.play()
}
function displayStatusMsg() {
status=cpADmsg[adNum];
document.returnValue = true;
}
file://½áÊø
// -->
</script>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="219" height="465" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="235" colspan="3"><table id="Table_01" width="210" height="256" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="3"> <img src="Images/1.gif" width="210" height="29" alt=""></td>
</tr>
<tr>
<td rowspan="2"> <img src="Images/2.gif" width="10" height="227" alt=""></td>
<td width="191">
<table height="148" cellspacing="0" cellpadding="0">
<tr>
<td width="191"> <a href="javascript:jump2url()"> <img style="FILTER: revealTrans
(duration=2,transition=23)" height="140" src width="191" border="0"
name="cpADrush"></a></td>
<script language="JavaScript">nextAd()</script>
</tr>
<tr>
<td>
<table width="191" name="T1" id="T1" border="0" cellspacing="1" cellpadding="0">
<tr>
<td align="right"><img src="image/dh_bg.gif" width="80"
height="16"></td>
<td width="20"><a href="javascript:;" onMouseOver="changeimg(0)"><img name="Image2"
id="img1" border="0" src="image/1.gif" width="20"
height="16" onClick="changeimg(0)"></a></td>
<td width="20"><a href="javascript:;" onMouseOver="changeimg(1)"><img name="Image3"
id="img2" border="0" src="image/2.gif" width="20"
height="16" onClick="changeimg(1)"></a></td>
<td width="20"><a href="javascript:;" onMouseOver="changeimg(2)"><img name="Image4"
id="img3" border="0" src="image/3.gif" width="20"
height="16" onClick="changeimg(2)"></a></td>
<td width="20"><a href="javascript:;" onMouseOver="changeimg(3)"><img name="Image5"
id="img4" border="0" src="image/4.gif" width="20"
height="16" onClick="changeimg(3)"></a></td>
<td width="20"><a href="javascript:;" onMouseOver="changeimg(4)"><img name="Image6"
id="img5" border="0" src="image/5.gif" width="20"
height="16" onClick="changeimg(4)"></a></td>
</tr>
</table>
</td>
</tr>
</table></td>
<td rowspan="2"> <img src="Images/4.gif" width="9" height="227" alt=""></td>
</tr>
<tr>
<td> <img src="Images/5.gif" width="191" height="71" alt=""></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="3"> <div align="center"></div></td>
</tr>
<tr>
<td colspan="3"><img src="Images/right_03.gif" width="219" height="48">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<td height="26" class="font1">
<marquee id='news' height="80" scrollamount='1' scrolldelay='10' behavior='loop' direction='up' border='0' onmouseover='this.stop()' onmouseout='this.start()'>
<div align="center">
<table width="177" height="34" border="0" cellpadding="0" cellspacing="0" dwcopytype="CopyTableCell">
<tr>
<td width="177" height="50" rowspan="3" valign="top">
<%set rs2=server.CreateObject("adodb.recordset")
sql2="select top 8 * from news where classid='5' order by id desc"
rs2.open sql2,conn,1,1
%>
<div align="center">
<table width="161" border="0" align="center">
<tr>
<td width="155" height="39" valign="top" class="font1">
<% if rs2.bof and rs2.eof then
response.write("»¹Ã»ÓÐÐÂÎÅ£¡")
else
do while not rs2.eof%>
<img src="Images/ico.gif" width="10" height="9"><a href="newsmore.asp?id=<%=rs2("id")%>" target="_blank" title="<%=rs2("title")%>">
&nbsp;<%=left(rs2("title"),15)%></a><br>
<%rs2.movenext
loop
end if
rs2.close
set rs2=nothing%>
</td>
</tr>
</table>
</div></td>
</tr>
<tr> </tr>
<tr> </tr>
</table>
</div>
</marquee>
</td>
</table></td>
</tr>
<tr>

</tr>
<tr>
<td height="81" colspan="3"><img src="Images/wangzhanlianjie.gif" width="219" height="55">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>

<td height="26" class="font1">
<marquee id='links' height="80" scrollamount='1' scrolldelay='10' behavior='loop' direction='up' border='0' onmouseover='this.stop()' onmouseout='this.start()'>
<div align="center"><img src="Images/links/baidu.gif" width="145" height="44" longdesc="http://www.baidu.com"> <img src="Images/links/GOOGLE.gif" width="145" height="44" longdesc="http://www.google.com"></div>
</marquee>
</td>
</tr>
</table>
<div align="center"> </div></td>
</tr>
</table>



tnAETI7k.jpg (25.7 KB)
图片附件: 游客没有浏览图片的权限,请 登录注册
搜索更多相关主题的帖子: javascript asp 
2006-09-25 15:50
islet
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:89
帖 子:6548
专家分:0
注 册:2005-1-28
收藏
得分:0 
<%i=0
do while not rs.eof%>
cpAD[<%=i%>]="<%=rs("pic")%>";
cpADlink[<%=i%>]="";
cpADmsg[<%=i%>]="";
<%rs.movenext
i=i+1
loop
rs.close%>

这不是javascript插ASP而是asp生成javascript
2006-09-25 15:54
firemx
Rank: 1
等 级:新手上路
帖 子:26
专家分:0
注 册:2006-9-25
收藏
得分:0 
谢谢
谢谢您的回复,谢谢
2006-09-25 15:59
firemx
Rank: 1
等 级:新手上路
帖 子:26
专家分:0
注 册:2006-9-25
收藏
得分:0 
我如何限定i的值为5呢
2006-09-25 16:01
firemx
Rank: 1
等 级:新手上路
帖 子:26
专家分:0
注 册:2006-9-25
收藏
得分:0 
出现错误
我刚就这句代码调试下出现错误了.您能不给把这代码加进去,谢谢,我刚学了一点asp还很菜/
2006-09-25 16:06
islet
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:89
帖 子:6548
专家分:0
注 册:2005-1-28
收藏
得分:0 
do while not rs.eof and i&lt;=5
2006-09-25 16:06
firemx
Rank: 1
等 级:新手上路
帖 子:26
专家分:0
注 册:2006-9-25
收藏
得分:0 
雨夜过客我能不能加您的QQ.
2006-09-25 16:08
firemx
Rank: 1
等 级:新手上路
帖 子:26
专家分:0
注 册:2006-9-25
收藏
得分:0 
是不是这么加呢?????出现错误了??
<!--#include file="news/conn.asp"-->
<script LANGUAGE="javascript">
<!--
var cpAD=new Array();
var cpADlink=new Array();
var cpADmsg=new Array();
var adNum=5; //&para;¨&Ograve;&aring;&Aacute;&Euml;5&cedil;&ouml;&Ecirc;&yacute;×é
var coll=0;
<%i=0
do while not rs.eof and i<=5%>
cpAD[<%=i%>]="<%=rs("img")%>";
cpADlink[<%=i%>]="";
cpADmsg[<%=i%>]="";
<%rs.movenext
i=i+1
loop
rs.close%>
var preloadedimages=new Array();
for (i=1;i<cpAD.length;i++){
preloadedimages[i]=new Image();
preloadedimages[i].src=cpAD[i];
}
//&Igrave;&oslash;×&ordf;&micro;&Auml;URL&micro;&Oslash;&Ouml;·
function jump2url()
{
jumpUrl=cpADlink[adNum];
jumpTarget='_blank';
if (jumpUrl != '')
{
if (jumpTarget != '')
window.open(jumpUrl,jumpTarget);
else location.href=jumpUrl;
}
}
//&Iacute;&frac14;&AElig;&not;±&auml;&raquo;&macr;&micro;&Auml;&ordm;&macr;&Ecirc;&yacute;
function changeimg(n)
{
adNum=n;
switch(adNum)
{
case 0:
{
window.img1.src="image/1-2.gif";
window.img2.src="image/2.gif";
window.img3.src="image/3.gif";
window.img4.src="image/4.gif";
window.img5.src="image/5.gif";
break;
}
case 1:
{
window.img1.src="image/1.gif";
window.img2.src="image/2-2.gif";
window.img3.src="image/3.gif";
window.img4.src="image/4.gif";
window.img5.src="image/5.gif";
break;
}
case 2:
{
window.img1.src="image/1.gif";
window.img2.src="image/2.gif";
window.img3.src="image/3-2.gif";
window.img4.src="image/4.gif";
window.img5.src="image/5.gif";
break;
}
case 3:
{
window.img1.src="image/1.gif";
window.img2.src="image/2.gif";
window.img3.src="image/3.gif";
window.img4.src="image/4-2.gif";
window.img5.src="image/5.gif";
break;
}
case 4:
{
window.img1.src="image/1.gif";
window.img2.src="image/2.gif";
window.img3.src="image/3.gif";
window.img4.src="image/4.gif";
window.img5.src="image/5-2.gif";
break;
}
}
window.clearInterval(theTimer);
adNum=adNum-1;
nextAd();
}
//&micro;±&micro;&atilde;&raquo;÷&Ecirc;±&Ouml;±&frac12;&Oacute;&Igrave;&oslash;×&ordf;
function nextAd(){
coll++;
if(coll>1)
{
switch(adNum+1)
{
case 5:
{
window.img1.src="image/1-2.gif";
window.img2.src="image/2.gif";
window.img3.src="image/3.gif";
window.img4.src="image/4.gif";
window.img5.src="image/5.gif";
break;
}
case 1:
{
window.img1.src="image/1-2.gif";
window.img2.src="image/2-2.gif";
window.img3.src="image/3.gif";
window.img4.src="image/4.gif";
window.img5.src="image/5.gif";
break;
}
case 2:
{
window.img1.src="image/1-2.gif";
window.img2.src="image/2.gif";
window.img3.src="image/3-2.gif";
window.img4.src="image/4.gif";
window.img5.src="image/5.gif";
break;
}
case 3:
{
window.img1.src="image/1-2.gif";
window.img2.src="image/2.gif";
window.img3.src="image/3.gif";
window.img4.src="image/4-2.gif";
window.img5.src="image/5.gif";
break;
}
case 4:
{
window.img1.src="image/1-2.gif";
window.img2.src="image/2.gif";
window.img3.src="image/3.gif";
window.img4.src="image/4.gif";
window.img5.src="image/5.gif";
break;
}
}
}
if(adNum<cpAD.length-1)adNum++ ;
else adNum=0;
setTransition();
document.images.cpADrush.src=cpAD[adNum];
playTransition();
displayStatusMsg();
//&para;¨&Ograve;&aring;&Aacute;&Euml;&Acirc;&Ouml;&raquo;&raquo;&Ecirc;±&frac14;&auml; 5s
theTimer=setTimeout("nextAd()", 5000);
}
function setTransition(){
if (document.all){
cpADrush.filters.revealTrans.Transition=23;
cpADrush.filters.revealTrans.apply();
}
}
function playTransition(){
if (document.all)
cpADrush.filters.revealTrans.play()
}
function displayStatusMsg() {
status=cpADmsg[adNum];
document.returnValue = true;
}
//&frac12;á&Ecirc;&oslash;
// -->
</script>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="219" height="465" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="235" colspan="3"><table id="Table_01" width="210" height="256" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="3"> <img src="Images/1.gif" width="210" height="29" alt=""></td>
</tr>
<tr>
<td rowspan="2"> <img src="Images/2.gif" width="10" height="227" alt=""></td>
<td width="191">
<table height="148" cellspacing="0" cellpadding="0">
<tr>
<td width="191"> <a href="javascript:jump2url()"> <img style="FILTER: revealTrans
(duration=2,transition=23)" height="140" src width="191" border="0"
name="cpADrush"></a></td>
<script language="JavaScript">nextAd()</script>
</tr>
<tr>
<td>
<table width="191" name="T1" id="T1" border="0" cellspacing="1" cellpadding="0">
<tr>
<td align="right"><img src="image/dh_bg.gif" width="80"
height="16"></td>
<td width="20"><a href="javascript:;" onMouseOver="changeimg(0)"><img name="Image2"
id="img1" border="0" src="image/1.gif" width="20"
height="16" onClick="changeimg(0)"></a></td>
<td width="20"><a href="javascript:;" onMouseOver="changeimg(1)"><img name="Image3"
id="img2" border="0" src="image/2.gif" width="20"
height="16" onClick="changeimg(1)"></a></td>
<td width="20"><a href="javascript:;" onMouseOver="changeimg(2)"><img name="Image4"
id="img3" border="0" src="image/3.gif" width="20"
height="16" onClick="changeimg(2)"></a></td>
<td width="20"><a href="javascript:;" onMouseOver="changeimg(3)"><img name="Image5"
id="img4" border="0" src="image/4.gif" width="20"
height="16" onClick="changeimg(3)"></a></td>
<td width="20"><a href="javascript:;" onMouseOver="changeimg(4)"><img name="Image6"
id="img5" border="0" src="image/5.gif" width="20"
height="16" onClick="changeimg(4)"></a></td>
</tr>
</table>
</td>
</tr>
</table></td>
<td rowspan="2"> <img src="Images/4.gif" width="9" height="227" alt=""></td>
</tr>
<tr>
<td> <img src="Images/5.gif" width="191" height="71" alt=""></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="3"> <div align="center"></div></td>
</tr>
<tr>
<td colspan="3"><img src="Images/right_03.gif" width="219" height="48">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<td height="26" class="font1">
<marquee id='news' height="80" scrollamount='1' scrolldelay='10' behavior='loop' direction='up' border='0' onmouseover='this.stop()' onmouseout='this.start()'>
<div align="center">
<table width="177" height="34" border="0" cellpadding="0" cellspacing="0" dwcopytype="CopyTableCell">
<tr>
<td width="177" height="50" rowspan="3" valign="top">
<%set rs2=server.CreateObject("adodb.recordset")
sql2="select top 8 * from news where classid='5' order by id desc"
rs2.open sql2,conn,1,1
%>
<div align="center">
<table width="161" border="0" align="center">
<tr>
<td width="155" height="39" valign="top" class="font1">
<% if rs2.bof and rs2.eof then
response.write("&raquo;&sup1;&Atilde;&raquo;&Oacute;&ETH;&ETH;&Acirc;&Icirc;&Aring;&pound;&iexcl;")
else
do while not rs2.eof%>
<img src="Images/ico.gif" width="10" height="9"><a href="newsmore.asp?id=<%=rs2("id")%>" target="_blank" title="<%=rs2("title")%>">
&nbsp;<%=left(rs2("title"),15)%></a><br>
<%rs2.movenext
loop
end if
rs2.close
set rs2=nothing%>
</td>
</tr>
</table>
</div></td>
</tr>
<tr> </tr>
<tr> </tr>
</table>
</div>
</marquee>
</td>
</table></td>
</tr>
<tr>

</tr>
<tr>
<td height="81" colspan="3"><img src="Images/wangzhanlianjie.gif" width="219" height="55">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>

<td height="26" class="font1">
<marquee id='links' height="80" scrollamount='1' scrolldelay='10' behavior='loop' direction='up' border='0' onmouseover='this.stop()' onmouseout='this.start()'>
<div align="center"><img src="Images/links/baidu.gif" width="145" height="44" longdesc="http://www.baidu.com"> <img src="Images/links/GOOGLE.gif" width="145" height="44" longdesc="http://www.google.com"></div>
</marquee>
</td>
</tr>
</table>
<div align="center"> </div></td>
</tr>
</table>
2006-09-25 16:11
islet
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:89
帖 子:6548
专家分:0
注 册:2005-1-28
收藏
得分:0 
啥错误?
2006-09-25 16:16
firemx
Rank: 1
等 级:新手上路
帖 子:26
专家分:0
注 册:2006-9-25
收藏
得分:0 
错误类型:
Microsoft VBScript 运行时错误 (0x800A01A8)
/11111111111/Tyi86_Left.asp, 第 10 行


浏览器类型:
Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0; Poco 0.31; TencentTraveler )

页:
GET /11111111111/Tyi86_Left.asp

时间:
2006-09-25 16:19
快速回复:[求助]javascript中加入asp
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.067481 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved