hta實現(xiàn)涂鴉效果代碼

字號:


    代碼如下:
    <html>     
    <head>     
    <hta:application     
    caption=no     
    scroll=no     
    showintaskbar=no     
    innerborder=no     
    contextmenu=no     
    border=none     
    singleinstance=yes     
    windowstate=maximize     
    >     
    <title></title>     
    <script>     
    var timer = 100;     
    var randdiv = new array(100);     
    window.onload = function()     
    {     
         for(var i = 0; i < randdiv.length; i++)     
         {     
                 randdiv[i] = document.createelement(div);     
                 randdiv[i].style.csstext = filter:progid:dximagetransform.microsoft.alpha(opacity=50);;     
                 randdiv[i].style.position = absolute;     
                 randdiv[i].style.background = getrandomcolor();     
                 document.body.appendchild(randdiv[i]);     
         }     
         fun();     
    }     
    function fun()     
    {     
         for(var i = 0; i < randdiv.length; i++)     
         {     
                 randdiv[i].style.top = math.floor(math.random() * window.screen.height);     
                 randdiv[i].style.left = math.floor(math.random() * window.screen.width);     
                 randdiv[i].style.width = math.floor(math.random() * 100);     
                 randdiv[i].style.height = math.floor(math.random() * 100);     
                 randdiv[i].style.background = getrandomcolor();     
         }     
         settimeout(fun(), timer);     
    }     
    function getrandomcolor()     
    {     
         var r = math.floor(math.random() * 255).tostring(16);     
         var g = math.floor(math.random() * 255).tostring(16);     
         var b = math.floor(math.random() * 255).tostring(16);     
         r = r.length == 1 ? 0 + r : r;     
         g = g.length == 1 ? 0 + g : g;     
         b = b.length == 1 ? 0 + b : b;     
         return # + r + g + b;     
    }     
    </script>     
    </head>     
    <body>     
    </body>     
    </html>
    木容涂鴉板(moron scratch) 可以在線生成一個在桌面上自動繪畫的應用程序。
    只需要你發(fā)揮想象繪制一副想要的圖案,然后點擊下載按鍵就可以得到一個很小的moron_scratch.exe的程序。
    雙擊運行它,就能看到你的鼠標在桌面上自動畫了起來 :)