午夜国产狂喷潮在线观看|国产AⅤ精品一区二区久久|中文字幕AV中文字幕|国产看片高清在线

    Javascript網(wǎng)頁特效:閃現(xiàn)的禮花背景
    來源:易賢網(wǎng) 閱讀:847 次 日期:2015-03-18 11:10:47
    溫馨提示:易賢網(wǎng)小編為您整理了“Javascript網(wǎng)頁特效:閃現(xiàn)的禮花背景”,方便廣大網(wǎng)友查閱!

    很老的效果了,但對(duì)于一些生手來說還是很有用處的。

    把如下代碼加入<body>區(qū)域中

    以下是引用片段:

    <layer name="a0" left=10 top=10 visibility=show bgcolor="#ffffff" clip="0,0,1,1"></layer>

    <layer name="a1" left=10 top=10 visibility=show bgcolor="#fff000" clip="0,0,1,1"></layer>

    <layer name="a2" left=10 top=10 visibility=show bgcolor="#ffa000" clip="0,0,1,1"></layer>

    <layer name="a3" left=10 top=10 visibility=show bgcolor="#ff00ff" clip="0,0,1,1"></layer>

    <layer name="a4" left=10 top=10 visibility=show bgcolor="#00ff00" clip="0,0,1,1"></layer>

    <layer name="a5" left=10 top=10 visibility=show bgcolor="#ff00ff" clip="0,0,1,1"></layer>

    <layer name="a6" left=10 top=10 visibility=show bgcolor="#ff0000" clip="0,0,1,1"></layer>

    <layer name="a7" left=10 top=10 visibility=show bgcolor="#ffffff" clip="0,0,1,1"></layer>

    <layer name="a8" left=10 top=10 visibility=show bgcolor="#fff000" clip="0,0,1,1"></layer>

    <layer name="a9" left=10 top=10 visibility=show bgcolor="#ffa000" clip="0,0,1,1"></layer>

    <layer name="a10" left=10 top=10 visibility=show bgcolor="#ff00ff" clip="0,0,1,1"></layer>

    <layer name="a11" left=10 top=10 visibility=show bgcolor="#00ff00" clip="0,0,2,2"></layer>

    <layer name="a12" left=10 top=10 visibility=show bgcolor="#0000ff" clip="0,0,2,2"></layer>

    <layer name="a13" left=10 top=10 visibility=show bgcolor="#ff0000" clip="0,0,2,2"></layer>

    <div id="starsDiv" style="position:absolute;top:0px;left:0px">

    <div style="position:relative;width:2px;height:2px;background:#ffffff;font-size:2px"></div>

    <div style="position:relative;width:1px;height:1px;background:#fff000;font-size:1px"></div>

    <div style="position:relative;width:1px;height:1px;background:#ffa000;font-size:1px"></div>

    <div style="position:relative;width:1px;height:1px;background:#ff00ff;font-size:1px"></div>

    <div style="position:relative;width:1px;height:1px;background:#00ff00;font-size:1px"></div>

    <div style="position:relative;width:1px;height:1px;background:#0000ff;font-size:1px"></div>

    <div style="position:relative;width:1px;height:1px;background:#FF0000;font-size:1px"></div>

    <div style="position:relative;width:1px;height:1px;background:#ffffff;font-size:1px"></div>

    <div style="position:relative;width:1px;height:1px;background:#fff000;font-size:1px"></div>

    <div style="position:relative;width:1px;height:1px;background:#ffa000;font-size:1px"></div>

    <div style="position:relative;width:1px;height:1px;background:#ff00ff;font-size:1px"></div>

    <div style="position:relative;width:2px;height:2px;background:#ff00ff;font-size:2px"></div>

    <div style="position:relative;width:1px;height:1px;background:#0000ff;font-size:1px"></div>

    <div style="position:relative;width:1px;height:1px;background:#FF0000;font-size:1px"></div>

    </div>

    <SCRIPT LANGUAGE="JavaScript">

    <!-- Begin

    var Clrs = new Array(9);

    Clrs[0] = 'ff0000';

    Clrs[1] = '00ff00';

    Clrs[2] = '000aff';

    Clrs[3] = 'ff00ff';

    Clrs[4] = 'ffa500';

    Clrs[5] = 'ffff00';

    Clrs[6] = '00ff00';

    Clrs[7] = 'ffffff';

    Clrs[8] = 'fffff0';

    var sClrs = new Array(5);

    sClrs[0] = 'ffa500';

    sClrs[1] = '55ff66';

    sClrs[2] = 'AC9DFC';

    sClrs[3] = 'fff000';

    sClrs[4] = 'fffff0';

    var yBase;

    var xBase;

    var step;

    var currStep = 0;

    var Xpos = 1;

    var Ypos = 1;

    var initialStarColor = 'ffa000';

    var Mtop = 250;

    var Mleft = 250;

    function Fireworks() {

    if (document.all) {

    yBase = window.document.body.offsetHeight / 3;

    xBase = window.document.body.offsetWidth / 8;

    }

    else if (document.layers) {

    yBase = window.innerHeight / 3;

    xBase = window.innerWidth / 8;

    }

    if (document.all) {

    step = 5;

    for ( i = 0 ; i < starsDiv.all.length ; i++ ) {

    for (ai = 0; ai < Clrs.length; ai++) {

    var c = Math.round(Math.random()*[ai]);

    }

    if (currStep < 90)

    starsDiv.all[i].style.background=initialStarColor;

    if (currStep > 90)

    starsDiv.all[i].style.background=Clrs[c];

    starsDiv.all[i].style.top = Mtop + yBase*Math.sin((currStep+i*5)/3)*Math.sin(550+currStep/100)

    starsDiv.all[i].style.left = Mleft + yBase*Math.cos((currStep+i*5)/3)*Math.sin(550+currStep/100)

    }

    }

    else if (document.layers) {

    step = 5;

    for ( j = 0 ; j < 24 ; j++ ) { //number of NS layers!

    var templayer = "a"+j;

    for (ai = 0; ai < Clrs.length; ai++) {

    var c = Math.round(Math.random()*[ai]);

    }

    if (currStep < 90)

    document.layers[templayer].bgColor=initialStarColor;

    if (currStep > 90)

    document.layers[templayer].bgColor=Clrs[c];

    document.layers[templayer].top = Mtop + yBase*Math.sin((currStep+j*5)/3)*Math.sin(550+currStep/100)

    document.layers[templayer].left = Mleft + yBase*Math.cos((currStep+j*5)/3)*Math.sin(550+currStep/100)

    }

    }

    currStep+= step;

    T=setTimeout("Fireworks()",5);

    if (currStep == 220) {

    currStep = -10;

    for (n = 0; n < sClrs.length; n++) {

    var k = Math.round(Math.random()*n);

    }

    initialStarColor = sClrs[k];

    if (document.all) {

    Dtop = window.document.body.clientHeight - 250;

    Dleft = xBase * 3.5;

    Mtop = Math.round(Math.random()*Dtop);

    Mleft = Math.round(Math.random()*Dleft);

    document.all.starsDiv.style.top = Mtop+document.body.scrollTop;

    document.all.starsDiv.style.left = Mleft+document.body.scrollLeft;

    }

    else if (document.layers) {

    Dleft = window.innerWidth - 100;

    Dtop = window.innerHeight - 100;

    Mtop = Math.round(Math.random()*Dtop+window.pageYOffset);

    Mleft = Math.round(Math.random()*Dleft+window.pageXOffset);

    document.layers[templayer].top = Mtop;

    document.layers[templayer].left = Mleft;

    }

    if ((Mtop < 20) || (Mleft < 20)) {

    Mtop += 90;

    Mleft += 90;

    }

    }

    }

    Fireworks();

    // End -->

    </script>

    閱讀關(guān)于 的全部文章

    更多信息請(qǐng)查看IT技術(shù)專欄

    更多信息請(qǐng)查看腳本欄目
    易賢網(wǎng)手機(jī)網(wǎng)站地址:Javascript網(wǎng)頁特效:閃現(xiàn)的禮花背景
    由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢回復(fù)僅供參考,敬請(qǐng)考生以權(quán)威部門公布的正式信息和咨詢?yōu)闇?zhǔn)!

    2025國(guó)考·省考課程試聽報(bào)名

    • 報(bào)班類型
    • 姓名
    • 手機(jī)號(hào)
    • 驗(yàn)證碼
    關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡(jiǎn)要咨詢 | 簡(jiǎn)要咨詢須知 | 新媒體/短視頻平臺(tái) | 手機(jī)站點(diǎn) | 投訴建議
    工業(yè)和信息化部備案號(hào):滇ICP備2023014141號(hào)-1 云南省教育廳備案號(hào):云教ICP備0901021 滇公網(wǎng)安備53010202001879號(hào) 人力資源服務(wù)許可證:(云)人服證字(2023)第0102001523號(hào)
    云南網(wǎng)警備案專用圖標(biāo)
    聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關(guān)注公眾號(hào):hfpxwx
    咨詢QQ:1093837350(9:00—18:00)版權(quán)所有:易賢網(wǎng)
    云南網(wǎng)警報(bào)警專用圖標(biāo)