能不能在javascript里嵌套asp语句

seasonzwt 2004-08-07 04:10:19
能不能在javascript里嵌套asp语句
...全文
61 点赞 收藏 4
写回复
4 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
lnqnwy 2004-08-07
可以!但是也得看你要嵌入什么语句啊!实现什么功能!javascript有一点不对都要报错的!
回复
王西之 2004-08-07
<SCRIPT language=JavaScript><!--

var e = top;
var e1 = "top";
var iLoc= self.location.href;
// List特性设置


function dspList(n){
var elmABlock= 30;//每页歌曲数量设置
var totElm = e.songName.length;//歌曲数量
var totBlock= Math.floor((e.songName.length -1) / elmABlock)+1;//页个数
var cblock;
if(n==null){cblock=1;}
else{cblock=n;}
var seed;
var limit;
if(cblock < totBlock){seed= elmABlock * (cblock-1); limit = cblock*elmABlock -1}
else{seed=elmABlock * (cblock-1); limit= totElm-1;}




if(e.songName.length >0 ){
<%
startime=timer()
dim conn
dim connstr
set conn=server.CreateObject("adodb.connection")
DBPath = Server.MapPath("../../luntan/djeep13h9mmb/joji29ji20vd.asp")
conn.open "provider=microsoft.jet.oledb.4.0; data source="&DBpath
%>


var list_num=0;
mmList.innerHTML='<p>';

<%
set rs=server.createobject("adodb.recordset")
rs.open "select * from jiemu order by id desc",conn,1,3
%>

i=seed
<%
while not rs.eof
%>
list_num = i;
var list_num1=i+1;

elm = '<table width=97% BORDER=0 CELLPADDING=0 CELLSPACING=0 align=center><tr><td>'
elm = elm + ' <font color=#000000>T' + list_num1 +'.</font> '
elm = elm + '<a href=#'
elm = elm + ' onclick="' + e1 + '.chooseSong('+ list_num +')">' + e.songName[i] + '</a></td><td width=53><a href=../index/main.asp?id=<%=rs("id")%>>相关主题</a></td><td width=63><a href='+e.songNum[i]+' target=_blank><img src=../images/downloads.gif border=0></a><br>';
elm = elm + '</td></tr></table>'
mmList.innerHTML=mmList.innerHTML+elm;
i=i+1
<%
rs.movenext

wend
rs.Close
set rs=nothing
%>

<%
set rs=server.createobject("adodb.recordset")
rs.open "select * from music order by id desc",conn,1,3
%>

<%
while not rs.eof
%>
list_num = i;
var list_num1=i+1;

elm = '<table width=97% BORDER=0 CELLPADDING=0 CELLSPACING=0 align=center><tr><td>'
elm = elm + ' <font color=#000000>T' + list_num1 +'.</font> '
elm = elm + '<a href=#'
elm = elm + ' onclick="' + e1 + '.chooseSong('+ list_num +')">' + e.songName[i] + '</a></td><td width=53><br>';
elm = elm + '</td></tr></table>'
mmList.innerHTML=mmList.innerHTML+elm;
i=i+1
<%
rs.movenext

wend
%>

if(totBlock>1){
pageList.innerHTML=' Page: ';

for(var j=1; j<=totBlock; j++){
page='<a href=javascript:dspList('+j+')>['+j+']<a> ';
pageList.innerHTML=pageList.innerHTML+page;
}





pageInfo.innerHTML='<span><font color=red>'+cblock+ '</font></span> / '+ totBlock;
}
else
{}
}
else { mmList.innerHTML='<div align=center> http://www.killerj.tk </div>'; }
}
--></SCRIPT>

-----------------------------------------------
我用过的一个例子
回复
王西之 2004-08-07
可以
回复
xiaobird1 2004-08-07
可以,功能有限
<%
Dim strTest
strTest = "test"
%>
<script>
alert("<%=strTest%>");
</script>
回复
相关推荐
发帖
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
帖子事件
创建了帖子
2004-08-07 04:10
社区公告
暂无公告