33、状态栏文字由中向两边显示

33、状态栏文字由中向两边显示

要完成此效果需要两个步骤

 

第一步:把如下代码加入到<head>区域中

 

<SCRIPT LANGUAGE="JavaScript">

<!-- hide script from old browsers

var phrase = "欢迎光临网页特效,请记住我们的网址:http://7stk.com";

var lenPhrase = phrase.length;

var phraseOut = "";

var pause = 100;

var i=0;

var j=0;

function explode() {

    i++;

    phraseOut = "";

    for (j=1; j<=(lenPhrase/2)-i; j++) {

      phraseOut += "  ";

    }

    for (j=1; j<=i; j++) {

      phraseOut += phrase.charAt(j-1);

    }

    for (j=i; j>=1; j--) {

      phraseOut += phrase.charAt(lenPhrase-j);

    }

    for (j=1; j<=(lenPhrase/2)-i; j++) {

      phraseOut += "  ";

    }

    window.status = phraseOut;

    if (i<lenPhrase/2) {

        setTimeout("explode()",pause);

    }

}

// end hiding contents -->

</SCRIPT>

 

 

第二步:把“OnLoad="explode()"”加在<body>标记里

例如:<body OnLoad="explode()">

 

Write a comment

Comments: 0