我想要在的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")%>">
<%=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>