js中插入asp代码
这是代码:<%setrs=server.CreateObject("adodb.recordset")sql="select*fromjswherepic_id=1ord...
这是代码:
<%set rs=server.CreateObject("adodb.recordset")
sql="select * from js where pic_id=1 order by id desc"
rs.open sql,conn,3,3
if not rs.eof then
%>
<script language="javascript">
function initEcAd() {
document.all.AdLayer1.style.posTop = -200;
document.all.AdLayer1.style.visibility = 'visible'
document.all.AdLayer2.style.posTop = -200;
document.all.AdLayer2.style.visibility = 'visible'
MoveLeftLayer('AdLayer1');
MoveRightLayer('AdLayer2');
}
function MoveLeftLayer(layerName) {
var x = 5;
var y = 100;// 左侧广告距离页首高度
var diff = (document.body.scrollTop + y - document.all.AdLayer1.style.posTop)*.40;
var y = document.body.scrollTop + y - diff;
eval("document.all." + layerName + ".style.posTop = parseInt(y)");
eval("document.all." + layerName + ".style.posLeft = x");
setTimeout("MoveLeftLayer('AdLayer1');", 20);
}
function MoveRightLayer(layerName) {
var x = 5;
var y = 100;// 右侧广告距离页首高度
var diff = (document.body.scrollTop + y - document.all.AdLayer2.style.posTop)*.40;
var y = document.body.scrollTop + y - diff;
eval("document.all." + layerName + ".style.posTop = y");
eval("document.all." + layerName + ".style.posRight = x");
setTimeout("MoveRightLayer('AdLayer2');", 20);
}
document.write("<div id=AdLayer1 style='position: absolute;visibility:hidden;z-index:1'><a href='http://www.makewing.com/lanren' target='_blank'><img src="<%=rs("pic")%>" border='0'></a></div>"
+"<div id=AdLayer2 style='position: absolute;visibility:hidden;z-index:1'><a href='http://www.makewing.com/lanren' target='_blank'><img src="<%=rs("pic")%>" border='0'></a></div>");
initEcAd()
</script>
<%
end if
rs.movenext
rs.close
set rs=nothing
%>
主要是想从数据库中提取图片以便好上传
请各位高手帮帮忙解决! 小弟我在这里感激不尽!并且我很急! 展开
<%set rs=server.CreateObject("adodb.recordset")
sql="select * from js where pic_id=1 order by id desc"
rs.open sql,conn,3,3
if not rs.eof then
%>
<script language="javascript">
function initEcAd() {
document.all.AdLayer1.style.posTop = -200;
document.all.AdLayer1.style.visibility = 'visible'
document.all.AdLayer2.style.posTop = -200;
document.all.AdLayer2.style.visibility = 'visible'
MoveLeftLayer('AdLayer1');
MoveRightLayer('AdLayer2');
}
function MoveLeftLayer(layerName) {
var x = 5;
var y = 100;// 左侧广告距离页首高度
var diff = (document.body.scrollTop + y - document.all.AdLayer1.style.posTop)*.40;
var y = document.body.scrollTop + y - diff;
eval("document.all." + layerName + ".style.posTop = parseInt(y)");
eval("document.all." + layerName + ".style.posLeft = x");
setTimeout("MoveLeftLayer('AdLayer1');", 20);
}
function MoveRightLayer(layerName) {
var x = 5;
var y = 100;// 右侧广告距离页首高度
var diff = (document.body.scrollTop + y - document.all.AdLayer2.style.posTop)*.40;
var y = document.body.scrollTop + y - diff;
eval("document.all." + layerName + ".style.posTop = y");
eval("document.all." + layerName + ".style.posRight = x");
setTimeout("MoveRightLayer('AdLayer2');", 20);
}
document.write("<div id=AdLayer1 style='position: absolute;visibility:hidden;z-index:1'><a href='http://www.makewing.com/lanren' target='_blank'><img src="<%=rs("pic")%>" border='0'></a></div>"
+"<div id=AdLayer2 style='position: absolute;visibility:hidden;z-index:1'><a href='http://www.makewing.com/lanren' target='_blank'><img src="<%=rs("pic")%>" border='0'></a></div>");
initEcAd()
</script>
<%
end if
rs.movenext
rs.close
set rs=nothing
%>
主要是想从数据库中提取图片以便好上传
请各位高手帮帮忙解决! 小弟我在这里感激不尽!并且我很急! 展开
4个回答
展开全部
document.write("<div id=AdLayer1 style='position: absolute;visibility:hidden;z-index:1'><a href='http://www.makewing.com/lanren' target='_blank'><img src='<%=rs("pic")%>' border='0'></a></div>"
+"<div id=AdLayer2 style='position: absolute;visibility:hidden;z-index:1'><a href='http://www.makewing.com/lanren' target='_blank'><img src='<%=rs("pic")%>' border='0'></a></div>");
+"<div id=AdLayer2 style='position: absolute;visibility:hidden;z-index:1'><a href='http://www.makewing.com/lanren' target='_blank'><img src='<%=rs("pic")%>' border='0'></a></div>");
展开全部
document.write("<div id=AdLayer1 style='position: absolute;visibility:hidden;z-index:1'><a href='http://www.makewing.com/lanren' target='_blank'><img src='<%=rs("pic")%>' border='0'></a></div>"
+"<div id=AdLayer2 style='position: absolute;visibility:hidden;z-index:1'><a href='http://www.makewing.com/lanren' target='_blank'><img src='<%=rs("pic")%>' border='0'></a></div>");
+"<div id=AdLayer2 style='position: absolute;visibility:hidden;z-index:1'><a href='http://www.makewing.com/lanren' target='_blank'><img src='<%=rs("pic")%>' border='0'></a></div>");
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
因为我无法知道你的数据库结构(如表名、字段名和你要查的条件等)以及服务器上的ASP(数据库连接字符串、连接是否已经被打开)所以给你以下思路:(其中 的
中文
部分
需要根据你的服务器上的数据进行修改)<!--#include
file="你的数据库连接文件"--><%dim
nameForSer,numberForSer,timeForSerdim
sqlsql
=
"select
*
from
你的表名
where
条件"dim
rsset
rs
=
server.CreateObject("ADODB.Recordset")rs.open
sql,你的数据库连接字符串,1,1
'后面的游标锁定类型和操作类型(1,1
表示只向前移动和只读操作)nameForSer
=
rs("名字所在的字段名")numberForSer
=
int(rs("数量所在的字段名"))timeForSer
=
rs("时间所在的字段名")rs.closeset
rs
=
Nothing%> <script
type="text/javascript">//
显示库存数量Ext.grid.dummyData
=
[
['<%=nameForSer%>,<%=numberForSer%>,'<%=timeForSer
%>'],];</script> 这是动态ASP页面的,如果你的页面是静态或伪静态HTML的,需要无刷AJAX技术的,Q我,我再写给你!
中文
部分
需要根据你的服务器上的数据进行修改)<!--#include
file="你的数据库连接文件"--><%dim
nameForSer,numberForSer,timeForSerdim
sqlsql
=
"select
*
from
你的表名
where
条件"dim
rsset
rs
=
server.CreateObject("ADODB.Recordset")rs.open
sql,你的数据库连接字符串,1,1
'后面的游标锁定类型和操作类型(1,1
表示只向前移动和只读操作)nameForSer
=
rs("名字所在的字段名")numberForSer
=
int(rs("数量所在的字段名"))timeForSer
=
rs("时间所在的字段名")rs.closeset
rs
=
Nothing%> <script
type="text/javascript">//
显示库存数量Ext.grid.dummyData
=
[
['<%=nameForSer%>,<%=numberForSer%>,'<%=timeForSer
%>'],];</script> 这是动态ASP页面的,如果你的页面是静态或伪静态HTML的,需要无刷AJAX技术的,Q我,我再写给你!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐于2016-04-12 · 知道合伙人数码行家
关注
展开全部
可以通过js获取asp里面变量的值。
可以这么实现:
假设ad.js里用到 var CompanyName;
<script language="javascript" src="ad.js"></script>
<script language="javascript">
CompanyName = "<%=CompanyName%>";
</script>
可以这么实现:
假设ad.js里用到 var CompanyName;
<script language="javascript" src="ad.js"></script>
<script language="javascript">
CompanyName = "<%=CompanyName%>";
</script>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询