hta實現(xiàn)的涂鴉效果
更新時間:2007年03月30日 00:00:00 作者:
hta:HTML Applications
hta是html的可執(zhí)行程序,制作很簡單,將文件*.htm改為*.hta就可以了。
不過hta有自己獨有的標(biāo)簽<hta>,并可設(shè)置其屬性達到很不錯的效果。
hta是制作小程序絕佳選擇。
下面是一個例子,幾天前在公司無聊時寫的。
代碼:
<HTML>
<HEAD>
<HTA:APPLICATION
CAPTION="no"
SCROLL="no"
SHOWINTASKBAR="no"
INNERBORDER="no"
CONTEXTMENU="no"
BORDER="none"
SINGLEINSTANCE="yes"
WINDOWSTATE="maximize"
>
<title>0009.cnblogs.com</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>
hta是html的可執(zhí)行程序,制作很簡單,將文件*.htm改為*.hta就可以了。
不過hta有自己獨有的標(biāo)簽<hta>,并可設(shè)置其屬性達到很不錯的效果。
hta是制作小程序絕佳選擇。
下面是一個例子,幾天前在公司無聊時寫的。
代碼:
復(fù)制代碼 代碼如下:
<HTML>
<HEAD>
<HTA:APPLICATION
CAPTION="no"
SCROLL="no"
SHOWINTASKBAR="no"
INNERBORDER="no"
CONTEXTMENU="no"
BORDER="none"
SINGLEINSTANCE="yes"
WINDOWSTATE="maximize"
>
<title>0009.cnblogs.com</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>
相關(guān)文章
如何使一個HTA位于屏幕中心(Win32_DesktopMonitor)
我們可以調(diào)整(如果需要)窗口大小并使其居中,但這樣做時會在屏幕上出現(xiàn)瞬間的閃爍。這并不是太明顯,其實際結(jié)果就是你所期望的:HTA 會位于屏幕中心2013-08-08
創(chuàng)建一個在標(biāo)題欄中沒有“關(guān)閉”按鈕的 HTA
創(chuàng)建一個在標(biāo)題欄中沒有“關(guān)閉”按鈕的 HTA...2007-03-03
VBS腳本的GUI界面 HTA簡明教程(網(wǎng)絡(luò)搜集整理)
HTA是HTML Application的縮寫(HTML應(yīng)用程序),是軟件開發(fā)的新概念,直接將HTML保存成HTA的格式,就是一個獨立的應(yīng)用軟件,雙擊就能運行,與VB、C++等程序語言所設(shè)計的軟件沒什么差別。2009-08-08

