Linux中国 Linux中国门户站!
设为主页 设为主页
收藏本站 收藏本站
 
当前位置 :首页 ->网站设计 ->JavaScript ->正文

Javascript模拟的DOS窗口

来源:Linuxdby.com 作者:Webmaster 时间:2007-06-05 点击: [收藏] [投稿]

            win.show(0, 0, window.screen.availWidth, height);
        }
    }
    else if (!win.isOpen)
    {
        win.show(0, 0, window.screen.availWidth, window.screen.availHeight);
    }
    timer = setTimeout("OpenCmdWindow(" + height + ")", 50);
}

function CreateCmdWindow(obj, left, top)
{
    var cmdWindow = win.document.createElement("TABLE");
    cmdWindow.border = 1;
    cmdWindow.className = "Cmd";
    cmdWindow.style.left = left;
    cmdWindow.style.top = top;
    cmdWindow.style.zIndex = cmdIndex++;
    var newRow = cmdWindow.insertRow();
    var newCell = newRow.insertCell();
    newCell.className = "Title";
    newCell.innerHTML = "<span>&nbsp;C:\\WINDOWS\\system32\\cmd.exe<\/span>" +
        "<button onclick=\"window.parent.CloseButtonClick(this);\">×<\/button>" +
        "<button onclick=\"window.parent.MaximizeButtonClick(this);\">□<\/button>" +
        "<button onclick=\"window.parent.MinimizeButtonClick(this);\">-<\/button>";
    newRow = cmdWindow.insertRow();
    newCell = newRow.insertCell();
    newCell.innerHTML = "<div class=\"Content\">" +
        "<p>Microsoft Windows XP [Version 5.1.2600]<\/p>" +
        "<p>(C) Copyright 1985-2001 Microsoft Corp.<\/p>" +
        "<p>&nbsp;<\/p>" +
        "<p>C:\\WINDOWS\\system32&gt;<\/p>" +
        "<div class=\"Adorn\"><\/div>" +
        "</div>";
    cmdWindow.onactivate = function (){ window.parent.CurrentCmdFocus(this); }
    cmdWindow.ondeactivate = function (){ window.parent.CurrentCmdBlur(this); }
    obj.appendChild(cmdWindow);
}

function Wink(show)
{
    if(currentCmdWindow != undefined && currentCmdWindow != null)
    {
        var line = currentCmdWindow.getElementsByTagName("P")[currentCmdWindow.getElementsByTagName("P").length - 1];
        if(show)
        {
            line.innerText += "_";
        }
        else
        {
            line.innerText = line.innerText.replace(/_$/, "");
        }
    }
    setTimeout("Wink(" + !show + ")", 500);
}

function GetRandomNum(max)
{
    return parseInt(Math.random() * max + 1);
}

window.onload = function()
{
    win.document.body.innerHTML = "<div id=\"Frame\" onselectstart=\"return false;\"></div>";
    win.document.appendChild(win.document.createElement("STYLE"));
    win.document.styleSheets[0].addRule("body", "padding: 0px; margin: 0px;");
    win.document.styleSheets[0].addRule("#Frame", "width: 100%; height: 100%; background: #3A6EA5;");
    win.document.styleSheets[0].addRule(".Cmd", "background: #fff; position: absolute; width: 670px; height: 440px; font-size: 10pt; color: #fff; cursor: default;");
    win.document.styleSheets[0].addRule(".Title", "filter: progid:DXImageTransform.Microsoft.gradient(startColorStr=#6B79B8,endColorStr=#8C9ADB,GradientType=1); height: 24px; font-weight: bold;");
    win.document.styleSheets[0].addRule(".Title span", "float: left; line-height: 20px;");
    win.document.styleSheets[0].addRule(".Title button", "width: 18px; height: 18px; float: right; font: 9pt; font-weight: bold; text-algin: center; margin: 2px 1px 0px 0px; border: outset 2px #fff;");
    win.document.styleSheets[0].addRule(".Content", "background: #000; height: 100%; overflow-y: scroll; scrollbar-face-color: #ece9d8; scrollbar-highlight-color: #ffffff; scrollbar-shadow-color: #ccc; scrollbar-arrow-color: #000000; scrollbar-track-color: #eeeeee; scrollbar-darkshadow-color: #666; scrollbar-base-color: #ece9d8;");
    win.document.styleSheets[0].addRule(".Content p", "margin: 0px; line-height: 16px;");

 如果您对本文有任何疑问或者建议,请到讨论区发表您的意见: >> 论坛入口 <<



上一篇:利用javascript从数据库取数据来实现CSDN首页图片的切换效果   下一篇:JavaScript技巧:让网页自动穿上外套

文章评论】 【收藏本文】 【推荐好友】 【打印本文】 【我要投稿】 【论坛讨论
更多相关文章
Power by linux-cn.com 粤ICP备05006655号