因kesion的纵向滚动js有些问题,所以我用我的方法替换纵向文字纵向滚动为文字轮显
修改方法,打开ks_cls/KS_RefreshFunctionCls.asp文件,在约550行左右找到
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'函数名:KS_C_R_A
'作 用: 通用滚动文章函数
'参 数: ArtilceSql 待查询的SQL语句,OpenTypStr链接打开类型,等
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Function KS_C_R_A(SqlStr, MarqueeWidth, MarqueeHeight, MarqueeSpeed, RollsDirection, OpenTypeStr, TitleLen, MarqueeStyle, DateRule, MarqueeBgcolor, TitleCss, DateCss)
Dim RS:Set RS=Server.CreateObject("ADODB.RECORDSET")
RS.Open SqlStr, Conn, 1, 1
If Not RS.EOF Then
Dim TempTitle, CurrTid, TitleStr,TitleCssStr, DateCssStr
TitleCssStr = KSCMS.GetCss(TitleCss): DateCssStr = KSCMS.GetCss(DateCss)
If MarqueeStyle = 1 Then '纵向间隔滚动
KS_C_R_A = " <div id=""Rolls1""><table cellspacing=""0"" cellpadding=""0"" width=""" & MarqueeWidth & """ border=""0"">"
Do While Not RS.EOF
CurrTid = RS("Tid"):TitleStr = RS("Title")
TempTitle = GetArticleTitle(TitleStr, TitleLen, False, RS("TitleType"), RS("TitleFontColor"), RS("TitleFontType"))
TempTitle = "<tr><td height=""20"">• <a" & TitleCssStr & " href=""" & (KSCMS.GetInfoUrl(1,RS)) & """" & OpenTypeStr & " title=""" & TitleStr & """>" & TempTitle & "</a>"
If CStr(DateRule) <> "0" And CStr("DateRule") <> "" Then
KS_C_R_A = KS_C_R_A & (TempTitle & " <span" & DateCssStr & ">" & KSCMS.DateFormat(RS("AddDate"), DateRule) & "</span></td></tr>" & vbCrLf)
Else
KS_C_R_A = KS_C_R_A & (TempTitle & "</td></tr>" & vbCrLf)
End If
RS.MoveNext
Loop
KS_C_R_A = KS_C_R_A & "</table></div><div id=""Rolls2"" style=""z-index: 1; visibility: hidden; position: absolute""></div>" & vbCrLf
KS_C_R_A = KS_C_R_A & "<script>" & vbCrLf
KS_C_R_A = KS_C_R_A & "marqueesHeight=" & MarqueeHeight & ";"
KS_C_R_A = KS_C_R_A & "scrillHeight=" & MarqueeHeight & ";"
KS_C_R_A = KS_C_R_A & "scrillspeed=" & MarqueeSpeed & ";"
KS_C_R_A = KS_C_R_A & "stoptimes=50;"
KS_C_R_A = KS_C_R_A & "stopscroll=false;"
KS_C_R_A = KS_C_R_A & "Rolls1.scrollTop=0;"
KS_C_R_A = KS_C_R_A & "with (Rolls1)" & vbCrLf
KS_C_R_A = KS_C_R_A & "{"
KS_C_R_A = KS_C_R_A & "style.width=0;"
KS_C_R_A = KS_C_R_A & "style.height=marqueesHeight;"
KS_C_R_A = KS_C_R_A & "style.overflowX=""visible"";"
KS_C_R_A = KS_C_R_A & "style.overflowY=""hidden"";"
KS_C_R_A = KS_C_R_A & "noWrap=true;"
KS_C_R_A = KS_C_R_A & "onmouseover=new Function(""stopscroll=true"");" & vbCrLf
KS_C_R_A = KS_C_R_A & "onmouseout=new Function(""stopscroll=false"");" & vbCrLf
KS_C_R_A = KS_C_R_A & "}" & vbCrLf
KS_C_R_A = KS_C_R_A & "preTop=0;" & vbCrLf
KS_C_R_A = KS_C_R_A & "currentTop=0;" & vbCrLf
KS_C_R_A = KS_C_R_A & "stoptime=0;" & vbCrLf
KS_C_R_A = KS_C_R_A & "function initRollsstext()" & vbCrLf
KS_C_R_A = KS_C_R_A & "{ Rolls2.innerHTML="""";"
KS_C_R_A = KS_C_R_A & "Rolls2.innerHTML+=Rolls1.innerHTML;"
KS_C_R_A = KS_C_R_A & "Rolls1.innerHTML=Rolls2.innerHTML+Rolls2.innerHTML;"
KS_C_R_A = KS_C_R_A & "setInterval(""scrollUp()"",scrillspeed);"
KS_C_R_A = KS_C_R_A & "}" & vbCrLf
KS_C_R_A = KS_C_R_A & "function scrollUp()" & vbCrLf
KS_C_R_A = KS_C_R_A & "{"
KS_C_R_A = KS_C_R_A & "if(stopscroll==true) return;" & vbCrLf
KS_C_R_A = KS_C_R_A & "currentTop+=1;"
KS_C_R_A = KS_C_R_A & "if(currentTop==scrillHeight)"
KS_C_R_A = KS_C_R_A & "{ stoptime+=1;"
KS_C_R_A = KS_C_R_A & "currentTop-=1;"
KS_C_R_A = KS_C_R_A & "if(stoptime==stoptimes)"
KS_C_R_A = KS_C_R_A & "{"
KS_C_R_A = KS_C_R_A & "currentTop=0; stoptime=0; }"
KS_C_R_A = KS_C_R_A & "}" & vbCrLf
KS_C_R_A = KS_C_R_A & "else {"
KS_C_R_A = KS_C_R_A & "preTop=Rolls1.scrollTop;" & vbCrLf
KS_C_R_A = KS_C_R_A & "Rolls1.scrollTop+=1;"
KS_C_R_A = KS_C_R_A & "if(preTop==Rolls1.scrollTop)" & vbCrLf
KS_C_R_A = KS_C_R_A & "{ Rolls1.scrollTop=Rolls2.offsetHeight-marqueesHeight;" & vbCrLf
KS_C_R_A = KS_C_R_A & "Rolls1.scrollTop+=1; }" & vbCrLf
KS_C_R_A = KS_C_R_A & "}"
KS_C_R_A = KS_C_R_A & "}" & vbCrLf
KS_C_R_A = KS_C_R_A & "setInterval("""",1000);" & vbCrLf
KS_C_R_A = KS_C_R_A & "initRollsstext();" & vbCrLf
KS_C_R_A = KS_C_R_A & "</script>"
Else '默认方式
Do While Not RS.EOF
CurrTid = RS("Tid")
TitleStr = RS("Title")
TempTitle = GetArticleTitle(TitleStr, TitleLen, False, RS("TitleType"), RS("TitleFontColor"), RS("TitleFontType"))
TempTitle = "<a" & TitleCssStr & " href=""" & (KSCMS.GetInfoUrl(1,RS)) & """" & OpenTypeStr & " title=""" & TitleStr & """>" & TempTitle & "</a>"
If CStr(DateRule) <> "0" And CStr("DateRule") <> "" Then
KS_C_R_A = KS_C_R_A & (TempTitle & " <span" & DateCssStr & ">" & KSCMS.DateFormat(RS("AddDate"), DateRule) & "</span>")
Else
KS_C_R_A = KS_C_R_A & TempTitle
End If
KS_C_R_A = KS_C_R_A & " "
RS.MoveNext
Loop
If MarqueeBgcolor <> "" Then
KS_C_R_A = "<Marquee scrollamount=""" & MarqueeSpeed & """ direction=""" & RollsDirection & """ width=""" & MarqueeWidth & """ Height=""" & MarqueeHeight & """ bgcolor=""" & MarqueeBgcolor & """ onmouseover=""this.stop();"" onmouseout=""this.start();"">" & KS_C_R_A & "</Marquee>"
Else
KS_C_R_A = "<Marquee scrollamount=""" & MarqueeSpeed & """ direction=""" & RollsDirection & """ width=""" & MarqueeWidth & """ Height=""" & MarqueeHeight & """ onmouseover=""this.stop();"" onmouseout=""this.start();"">" & KS_C_R_A & "</Marquee>"
End If
End If
RS.Close:Set RS = Nothing
Else
KS_C_R_A = "":RS.Close:Set RS = Nothing
End If
End Function
替换为:
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'函数名:KS_C_R_A
'作 用: 通用滚动文章函数2006.11.19 Monfs修改
'参 数: ArtilceSql 待查询的SQL语句,OpenTypStr链接打开类型,等
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Function KS_C_R_A(SqlStr, MarqueeWidth, MarqueeHeight, MarqueeSpeed, RollsDirection, OpenTypeStr, TitleLen, MarqueeStyle, DateRule, MarqueeBgcolor, TitleCss, DateCss)
Dim RS:Set RS=Server.CreateObject("ADODB.RECORDSET")
Dim i
i=0
RS.Open SqlStr, Conn, 1, 1
If Not RS.EOF Then
Dim TempTitle, CurrTid, TitleStr,TitleCssStr, DateCssStr
TitleCssStr = KSCMS.GetCss(TitleCss): DateCssStr = KSCMS.GetCss(DateCss)
If MarqueeStyle = 1 Then '纵向间隔滚动
KS_C_R_A = " <script>var tickercontents=new Array();"
Do While Not RS.EOF
CurrTid = RS("Tid"):TitleStr = RS("Title")
TempTitle = GetArticleTitle(TitleStr, TitleLen, False, RS("TitleType"), RS("TitleFontColor"), RS("TitleFontType"))
TempTitle = "tickercontents["& i &"]='·<a" & TitleCssStr & " href=""" & (KSCMS.GetInfoUrl(1,RS)) & """" & OpenTypeStr & " title=""" & TitleStr & """>" & TempTitle & "</a>';"
If CStr(DateRule) <> "0" And CStr("DateRule") <> "" Then
KS_C_R_A = KS_C_R_A & (TempTitle & " <span" & DateCssStr & ">" & KSCMS.DateFormat(RS("AddDate"), DateRule) & "</span>;" & vbCrLf)
Else
KS_C_R_A = KS_C_R_A & (TempTitle & "var tickerwidth=""" & MarqueeWidth & """;" & vbCrLf)
End If
i=i+1
RS.MoveNext
Loop
KS_C_R_A = KS_C_R_A & "var tickerheight=""" & MarqueeHeight & """;" & vbCrLf
KS_C_R_A = KS_C_R_A & "var tickerbgcolor=""" & MarqueeBgcolor & """;" & vbCrLf
KS_C_R_A = KS_C_R_A & "var tickdelay=3000;" & vbCrLf
KS_C_R_A = KS_C_R_A & "var currentmessage=0;"
KS_C_R_A = KS_C_R_A & "function changetickercontent(){"
KS_C_R_A = KS_C_R_A & "if (document.layers){"
KS_C_R_A = KS_C_R_A & "document.tickernsmain.document.tickernssub.document.write(tickercontents[currentmessage]);"
KS_C_R_A = KS_C_R_A & "document.tickernsmain.document.tickernssub.document.close();"
KS_C_R_A = KS_C_R_A & "}" & vbCrLf
KS_C_R_A = KS_C_R_A & "else if (document.all) tickerie.innerHTML=tickercontents[currentmessage];"
KS_C_R_A = KS_C_R_A & "if (currentmessage==tickercontents.length-1) currentmessage=0;"
KS_C_R_A = KS_C_R_A & "else currentmessage++;"
KS_C_R_A = KS_C_R_A & "setTimeout(""changetickercontent()"",tickdelay);"
KS_C_R_A = KS_C_R_A & "}"
KS_C_R_A = KS_C_R_A & "function start_ticking(){" & vbCrLf
KS_C_R_A = KS_C_R_A & "if (document.layers)" & vbCrLf
KS_C_R_A = KS_C_R_A & "document.tickernsmain.visibility=""show"";" & vbCrLf
KS_C_R_A = KS_C_R_A & "changetickercontent();" & vbCrLf
KS_C_R_A = KS_C_R_A & "}" & vbCrLf
KS_C_R_A = KS_C_R_A & "if (document.all)" & vbCrLf
KS_C_R_A = KS_C_R_A & "document.write('<div id=""tickerie"" style=""width:'+tickerwidth+'; height:'+tickerheight+'; background-color:'+tickerbgcolor+'""></div>');" & vbCrLf
KS_C_R_A = KS_C_R_A & "window.onload=start_ticking;"
KS_C_R_A = KS_C_R_A & "</script>"
Else '默认方式
Do While Not RS.EOF
CurrTid = RS("Tid")
TitleStr = RS("Title")
TempTitle = GetArticleTitle(TitleStr, TitleLen, False, RS("TitleType"), RS("TitleFontColor"), RS("TitleFontType"))
TempTitle = "<a" & TitleCssStr & " href=""" & (KSCMS.GetInfoUrl(1,RS)) & """" & OpenTypeStr & " title=""" & TitleStr & """>" & TempTitle & "</a>"
If CStr(DateRule) <> "0" And CStr("DateRule") <> "" Then
KS_C_R_A = KS_C_R_A & (TempTitle & " <span" & DateCssStr & ">" & KSCMS.DateFormat(RS("AddDate"), DateRule) & "</span>")
Else
KS_C_R_A = KS_C_R_A & TempTitle
End If
KS_C_R_A = KS_C_R_A & " "
RS.MoveNext
Loop
If MarqueeBgcolor <> "" Then
KS_C_R_A = "<Marquee scrollamount=""" & MarqueeSpeed & """ direction=""" & RollsDirection & """ width=""" & MarqueeWidth & """ Height=""" & MarqueeHeight & """ bgcolor=""" & MarqueeBgcolor & """ onmouseover=""this.stop();"" onmouseout=""this.start();"">" & KS_C_R_A & "</Marquee>"
Else
KS_C_R_A = "<Marquee scrollamount=""" & MarqueeSpeed & """ direction=""" & RollsDirection & """ width=""" & MarqueeWidth & """ Height=""" & MarqueeHeight & """ onmouseover=""this.stop();"" onmouseout=""this.start();"">" & KS_C_R_A & "</Marquee>"
End If
End If
RS.Close:Set RS = Nothing
Else
KS_C_R_A = "":RS.Close:Set RS = Nothing
End If
End Function
声明:
1、此方法修改后,{LB_*滚动}和{JS_*滚动}均可以正常使用,用Js的时候注意要生成JS,系统没有定时和自动刷新!!!
2、修改后,请确认滚动方式为:纵向间隔滚动
3、在使用纵向滚动的时候请不要选择显示日期,显示日期后会出错,我还没有想到解决办法!谁解决了就跟帖发出来呀!
附上原文:
<script>
var tickercontents=new Array()
tickercontents[0]='See what\'s New at Dynamic Drive. <a href="../../../dynamicdrive.com/new.htm">[Read more]</a>'
tickercontents[1]='Browse the most popular scripts on Dynamic Drive <a href="../../../dynamicdrive.com/hot.htm">[Read more]</a>'
tickercontents[2]='Link back to Dynamic Drive! <a href="../../../dynamicdrive.com/link.htm">[Read more]</a>'
var tickerwidth='65%'
var tickerbgcolor='lightblue'
var tickdelay=3000
var currentmessage=0
function changetickercontent(){
if (document.layers){
document.tickernsmain.document.tickernssub.document.write(tickercontents[currentmessage])
document.tickernsmain.document.tickernssub.document.close()
}
else if (document.all)
tickerie.innerHTML=tickercontents[currentmessage]
if (currentmessage==tickercontents.length-1) currentmessage=0
else currentmessage++
setTimeout("changetickercontent()",tickdelay)
}
function start_ticking(){
if (document.layers)
document.tickernsmain.visibility="show"
changetickercontent()
}
if (document.all)
document.write('<div id="tickerie" style="width:'+tickerwidth+'; background-color:'+tickerbgcolor+'"></div>')
window.onload=start_ticking
</script>
可直接存储为html