熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> JSP教程 >> 正文

從右到左的文字

2013-11-15 11:45:16  來源: JSP教程 

  腳本說明:

  把如下代碼加入<head>區域中

  <script language=JavaScript>

  var MESSAGE  =     歡迎來到正點網絡 請多提意見謝謝!   

  var POSITION =

  var DELAY    =

  var scroll = new statusMessageObject()

  function statusMessageObject(pd) {

  thismsg = MESSAGE

  thisout =

  thispos = POSITION

  thisdelay = DELAY

  thisi     =

  thisreset = clearmessage}

  function clearmessage() {

  thispos = POSITION}

  function scroller() {

  for (scrolli = ; scrolli < scrollpos; scrolli++) {

  scrollout += }

  if (scrollpos >= )

  scrollout += scrollmsg

  else scrollout = scrollmsgsubstring(scrollposscrollmsglength)

  windowstatus = scrollout

  scrollout =

  scrollpos

  if (scrollpos < (scrollmsglength)) {

  scrollreset()}

  setTimeout (scroller()scrolldelay)}

  function snapIn(jumpSpacesposition) {

  var msg = scrollmsg

  var out =

  for (var i=; i<position; i++)

  {out += msgcharAt(i)}

  for (i=;i<jumpSpaces;i++)

  {out += }

  out += msgcharAt(position)

  windowstatus = out

  if (jumpSpaces <= ) {

  position++

  if (msgcharAt(position) == )

  {position++ }

  jumpSpaces = position

  } else if (jumpSpaces >  )

  {jumpSpaces *= }

  else

  {jumpSpaces}

  if (position != msglength) {

  var cmd = snapIn( + jumpSpaces + + position + );

  scrollID = windowsetTimeout(cmdscrolldelay);

  } else {    windowstatus=

  jumpSpaces=

  position=

  cmd = snapIn( + jumpSpaces + + position + );

  scrollID = windowsetTimeout(cmdscrolldelay);

  return false }

  return true}

  snapIn();

  </script>


From:http://tw.wingwit.com/Article/program/Java/JSP/201311/19559.html
    推薦文章
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.