浪漫部落 - 浪漫森林

标题: hta实现的涂鸦效果 [打印本页]

作者: 魑魅魍魉    时间: 2007-12-16 09:07
标题: hta实现的涂鸦效果
hta:HTML Applications
hta是html的可执行程序,制作很简单,将文件*.htm改为*.hta就可以了。
不过hta有自己独有的标签<hta>,并可设置其属性达到很不错的效果。
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 = document.createElement("DIV");
        randDiv.style.cssText = "filter:progidXImageTransform.Microsoft.Alpha(opacity=50);";
        randDiv.style.position = "absolute";
        randDiv.style.background = GetRandomColor();
        document.body.appendChild(randDiv);
    }
    Fun();
}
function Fun()
{
    for(var i = 0; i < randDiv.length; i++)
    {
        randDiv.style.top = Math.floor(Math.random() * window.screen.height);
        randDiv.style.left = Math.floor(Math.random() * window.screen.width);
        randDiv.style.width = Math.floor(Math.random() * 100);
        randDiv.style.height = Math.floor(Math.random() * 100);
        randDiv.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>
作者: LM_love    时间: 2007-12-16 09:57
这是什么啊   看不懂  全是代码




欢迎光临 浪漫部落 - 浪漫森林 (http://bbs.weet.com.cn/) Powered by Discuz! X3