<!--#include file="articleconn.asp"-->
<%'response.end%>
<HTML><HEAD><TITLE>新橱窗</TITLE>
<META http-equiv=Content-Type content=text/html; charset=gb2312><SCRIPT language=JavaScript><!--
var ver = 3
bVer = parseInt(navigator.appVersion);
if(bVer >= 4) ver = 4var ns = navigator.appName == "Netscape";
var ie = navigator.appName == "MSIE";//////////// ticker variables ////////////////////////////////////////var pix = 1; // number of pixels to move per frame
var rate = 80; // frames per second
var ImgWidth = 720; // width of ticker image/////////////////////////////////////////////////////////////////////var time = 1000/rate;
var again = - ImgWidth
function tick() {if (ver ==3) returnif (ns){
document.Layer1.offset(-pix,0); document.Layer2.offset(-pix,0); if (document.Layer1.left <= again) document.Layer1.left = ImgWidth; if (document.Layer2.left <= again) document.Layer2.left = ImgWidth;
}
else {
newpix = document.all["Layer1"].style.pixelLeft - pix;
newpix2 = document.all["Layer2"].style.pixelLeft - pix; document.all["Layer1"].style.pixelLeft = newpix; document.all["Layer2"].style.pixelLeft = newpix2; if (document.all["Layer1"].style.pixelLeft <= again) document.all["Layer1"].style.pixelLeft = ImgWidth; if (document.all["Layer2"].style.pixelLeft <= again) document.all["Layer2"].style.pixelLeft = ImgWidth;
} setTimeout('tick()', time);
}//--></SCRIPT>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}function MM_openBrWindow(theURL) {
window.open(theURL,'','scrollbars=1,resizable=yes,width=460,height=380');
}
//-->
</SCRIPT><META content="MSHTML 6.00.2800.1106" name=GENERATOR>
<link href="style.css" rel="stylesheet" type="text/css">
<link href="tour-css.css" rel="stylesheet" type="text/css">
</HEAD>
<BODY background="images/mine_bj2.gif" topMargin=0
marginwidth="0" marginheight="0" onload=tick() marginleft="0" marginright="0">
<DIV align=left>
<TABLE cellSpacing=0 cellPadding=0 border=0 columns="0">
<TBODY>
<TR>
<TD><SPAN id=Layer1
style="Z-INDEX: 2; LEFT: 0px; WIDTH: 720px; POSITION: absolute; TOP: 8px; HEIGHT: 100px">
<% set rs=server.createobject("adodb.recordset")
sql="select top 7 newsid,title,path,picurl,N_Fname,linkurl from news_table where picchk=1 and typeid = 295 order by newsid desc"
rs.open sql,conn,1,1
%>
<table width="100%" border="0" cellspacing="2" cellpadding="0">
<tr> <%do while not rs.eof%>
<td width="131"> <div align="center">
<table width="95" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><div align="center"><a onMouseOver="javascript:this.style.cssText='CURSOR: hand;'" onClick="window.open('<%if rs("linkurl")="null" then%>open.asp?id=<%=rs("newsid")%>&path=<%=rs("path")%>&filename=<%=rs("N_Fname")%><%else%><%=rs("linkurl")%><%end if%>')"><img src="<%=rs("picurl")%>"></a></div></td>
</tr>
<tr>
<td height="28" background="images/huaqng.gif"><div align="center"><a href="#" class="a_white"><%=rs("title")%></a></div></td>
</tr>
</table>
</div></td>
<% c=c+1
rs.movenext
if c>=7 then exit do
loop
rs.close
%>
</tr>
</table>
</SPAN> <SPAN id=Layer2
style="Z-INDEX: 1; LEFT: 720px; WIDTH: 720px; POSITION: absolute; TOP: 8px; HEIGHT: 100px">
<% set rs=server.createobject("adodb.recordset")
sql="select top 7 newsid,title,path,picurl,N_Fname,linkurl from news_table where picchk=1 and typeid = 295 order by newsid desc"
rs.open sql,conn,1,1
%>
<table width="100%" border="0" cellspacing="2" cellpadding="0">
<tr>
<%do while not rs.eof%>
<td width="131"> <div align="center">
<table width="95" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><div align="center"><a onMouseOver="javascript:this.style.cssText='CURSOR: hand;'" onClick="window.open('<%if rs("linkurl")="null" then%>open.asp?id=<%=rs("newsid")%>&path=<%=rs("path")%>&filename=<%=rs("N_Fname")%><%else%><%=rs("linkurl")%><%end if%>')"><img src="<%=rs("picurl")%>"></a></div></td>
</tr>
<tr>
<td height="28" background="images/huaqng.gif"><div align="center"><a href="#" class="a_white"><%=rs("title")%></a></div></td>
</tr>
</table>
</div></td>
<% j=j+1
rs.movenext
if j>=7 then exit do
loop
rs.close
%>
</tr>
</table>
</SPAN>
</TD>
</TR></TBODY></TABLE>
</DIV>
</BODY></HTML> </TD></TR></TBODY></TABLE></DIV></BODY></HTML>
<%'response.end%>
<HTML><HEAD><TITLE>新橱窗</TITLE>
<META http-equiv=Content-Type content=text/html; charset=gb2312><SCRIPT language=JavaScript><!--
var ver = 3
bVer = parseInt(navigator.appVersion);
if(bVer >= 4) ver = 4var ns = navigator.appName == "Netscape";
var ie = navigator.appName == "MSIE";//////////// ticker variables ////////////////////////////////////////var pix = 1; // number of pixels to move per frame
var rate = 80; // frames per second
var ImgWidth = 720; // width of ticker image/////////////////////////////////////////////////////////////////////var time = 1000/rate;
var again = - ImgWidth
function tick() {if (ver ==3) returnif (ns){
document.Layer1.offset(-pix,0); document.Layer2.offset(-pix,0); if (document.Layer1.left <= again) document.Layer1.left = ImgWidth; if (document.Layer2.left <= again) document.Layer2.left = ImgWidth;
}
else {
newpix = document.all["Layer1"].style.pixelLeft - pix;
newpix2 = document.all["Layer2"].style.pixelLeft - pix; document.all["Layer1"].style.pixelLeft = newpix; document.all["Layer2"].style.pixelLeft = newpix2; if (document.all["Layer1"].style.pixelLeft <= again) document.all["Layer1"].style.pixelLeft = ImgWidth; if (document.all["Layer2"].style.pixelLeft <= again) document.all["Layer2"].style.pixelLeft = ImgWidth;
} setTimeout('tick()', time);
}//--></SCRIPT>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}function MM_openBrWindow(theURL) {
window.open(theURL,'','scrollbars=1,resizable=yes,width=460,height=380');
}
//-->
</SCRIPT><META content="MSHTML 6.00.2800.1106" name=GENERATOR>
<link href="style.css" rel="stylesheet" type="text/css">
<link href="tour-css.css" rel="stylesheet" type="text/css">
</HEAD>
<BODY background="images/mine_bj2.gif" topMargin=0
marginwidth="0" marginheight="0" onload=tick() marginleft="0" marginright="0">
<DIV align=left>
<TABLE cellSpacing=0 cellPadding=0 border=0 columns="0">
<TBODY>
<TR>
<TD><SPAN id=Layer1
style="Z-INDEX: 2; LEFT: 0px; WIDTH: 720px; POSITION: absolute; TOP: 8px; HEIGHT: 100px">
<% set rs=server.createobject("adodb.recordset")
sql="select top 7 newsid,title,path,picurl,N_Fname,linkurl from news_table where picchk=1 and typeid = 295 order by newsid desc"
rs.open sql,conn,1,1
%>
<table width="100%" border="0" cellspacing="2" cellpadding="0">
<tr> <%do while not rs.eof%>
<td width="131"> <div align="center">
<table width="95" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><div align="center"><a onMouseOver="javascript:this.style.cssText='CURSOR: hand;'" onClick="window.open('<%if rs("linkurl")="null" then%>open.asp?id=<%=rs("newsid")%>&path=<%=rs("path")%>&filename=<%=rs("N_Fname")%><%else%><%=rs("linkurl")%><%end if%>')"><img src="<%=rs("picurl")%>"></a></div></td>
</tr>
<tr>
<td height="28" background="images/huaqng.gif"><div align="center"><a href="#" class="a_white"><%=rs("title")%></a></div></td>
</tr>
</table>
</div></td>
<% c=c+1
rs.movenext
if c>=7 then exit do
loop
rs.close
%>
</tr>
</table>
</SPAN> <SPAN id=Layer2
style="Z-INDEX: 1; LEFT: 720px; WIDTH: 720px; POSITION: absolute; TOP: 8px; HEIGHT: 100px">
<% set rs=server.createobject("adodb.recordset")
sql="select top 7 newsid,title,path,picurl,N_Fname,linkurl from news_table where picchk=1 and typeid = 295 order by newsid desc"
rs.open sql,conn,1,1
%>
<table width="100%" border="0" cellspacing="2" cellpadding="0">
<tr>
<%do while not rs.eof%>
<td width="131"> <div align="center">
<table width="95" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><div align="center"><a onMouseOver="javascript:this.style.cssText='CURSOR: hand;'" onClick="window.open('<%if rs("linkurl")="null" then%>open.asp?id=<%=rs("newsid")%>&path=<%=rs("path")%>&filename=<%=rs("N_Fname")%><%else%><%=rs("linkurl")%><%end if%>')"><img src="<%=rs("picurl")%>"></a></div></td>
</tr>
<tr>
<td height="28" background="images/huaqng.gif"><div align="center"><a href="#" class="a_white"><%=rs("title")%></a></div></td>
</tr>
</table>
</div></td>
<% j=j+1
rs.movenext
if j>=7 then exit do
loop
rs.close
%>
</tr>
</table>
</SPAN>
</TD>
</TR></TBODY></TABLE>
</DIV>
</BODY></HTML> </TD></TR></TBODY></TABLE></DIV></BODY></HTML>
需要设定一个全局变量表示方向。<SCRIPT language=JavaScript><!--
var ver = 3
var direction="-";//初始方向
bVer = parseInt(navigator.appVersion);
if(bVer >= 4) ver = 4var ns = navigator.appName == "Netscape";
var ie = navigator.appName == "MSIE";//////////// ticker variables ////////////////////////////////////////var pix = 1; // number of pixels to move per frame
var rate = 80; // frames per second
var ImgWidth = 720; // width of ticker image/////////////////////////////////////////////////////////////////////var time = 1000/rate;
var again = - ImgWidth
function tick() {if (ver ==3) returnif (ns){
document.Layer1.offset(-pix,0); document.Layer2.offset(-pix,0); if (document.Layer1.left <= again) document.Layer1.left = ImgWidth; if (document.Layer2.left <= again) document.Layer2.left = ImgWidth;
}
else {
if (direction=="-")
{newpix = document.all["Layer1"].style.pixelLeft - pix;
newpix2 = document.all["Layer2"].style.pixelLeft - pix;}
else
{
newpix = document.all["Layer1"].style.pixelLeft +pix;
newpix2 = document.all["Layer2"].style.pixelLeft + pix;}
document.all["Layer1"].style.pixelLeft = newpix; document.all["Layer2"].style.pixelLeft = newpix2; if (document.all["Layer1"].style.pixelLeft <= again)
direction="+";//改编方向
if (document.all["Layer1"].style.pixelLeft >=ImgWidth)
direction="+";//改编方向//document.all["Layer1"].style.pixelLeft = ImgWidth; if (document.all["Layer2"].style.pixelLeft <= again) document.all["Layer2"].style.pixelLeft = ImgWidth;
} setTimeout('tick()', time);
}//--></SCRIPT>
我的代码仅仅是示例星的。
direction="+";//改编方向
if (document.all["Layer1"].style.pixelLeft >=ImgWidth)
direction="-";//改编方向
想把它变成从左向右的,谢谢
newpix = document.all["Layer1"].style.pixelLeft + pix;
newpix2 = document.all["Layer2"].style.pixelLeft + pix; document.all["Layer1"].style.pixelLeft = newpix; document.all["Layer2"].style.pixelLeft = newpix2; if (document.all["Layer1"].style.pixelLeft >= ImgWidth) document.all["Layer1"].style.pixelLeft = 0; if (document.all["Layer2"].style.pixelLeft >= ImgWidth) document.all["Layer2"].style.pixelLeft = 0;
} setTimeout('tick()', time);
) document.all["Layer1"].style.pixelLeft = 0(从哪里开始滚);
你可以改变一下坐标。
SCRIPT language=JavaScript><!--
var ver = 3
bVer = parseInt(navigator.appVersion);
if(bVer >= 4) ver = 4var ns = navigator.appName == "Netscape";
var ie = navigator.appName == "MSIE";//////////// ticker variables ////////////////////////////////////////var pix = 1; // number of pixels to move per frame
var rate = 80; // frames per second
var ImgWidth = 720; // width of ticker image/////////////////////////////////////////////////////////////////////var time = 1000/rate;
var again = - ImgWidth
function tick() {if (ver ==3) returnif (ns){
document.Layer1.offset(-pix,0); document.Layer2.offset(-pix,0); if (document.Layer1.left <= again) document.Layer1.left = ImgWidth; if (document.Layer2.left <= again) document.Layer2.left = ImgWidth;
}
else {
newpix = document.all["Layer1"].style.pixelLeft + pix;
newpix2 = document.all["Layer2"].style.pixelLeft + pix; document.all["Layer1"].style.pixelLeft = newpix; document.all["Layer2"].style.pixelLeft = newpix2; if (document.all["Layer1"].style.pixelLeft >=ImgWidth) document.all["Layer1"].style.pixelLeft = 0; if (document.all["Layer2"].style.pixelLeft >=ImgWidth) document.all["Layer2"].style.pixelLeft = 0;
} setTimeout('tick()', time);
}//--></SCRIPT>
不行啊
网页同一目录下,即可运行。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="JavaScript" type="text/JavaScript">
var id;
function StartGlide()
{
document.all.banner.style.pixelLeft=document.body.offsetWidth;
document.all.banner.style.visibility="visible";
id=window.setInterval("Glide()",200);
}
function Glide()
{
document.all.banner.style.pixelLeft+=10;
if (document.all.banner.style.pixelLeft>=1000)
{
document.all.banner.style.pixelLeft=0;
// window.clearInterval(id);
}
}</script>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="JavaScript" type="text/JavaScript">
var id;
function StartGlide()
{
document.all.banner.style.pixelLeft=document.body.offsetWidth;
document.all.banner.style.visibility="visible";
id=window.setInterval("Glide()",200);
}
function Glide()
{
document.all.banner.style.pixelLeft+=10;
if (document.all.banner.style.pixelLeft>=1000)
{
document.all.banner.style.pixelLeft=0;
// window.clearInterval(id);
}
}</script></head><body onload="StartGlide()">
<img id="banner" style="position:absolute;top:0;left:0;" src="snow.gif">
</body>
</html>