分享
 
 
 

Javascript模拟的DOS窗口

王朝html/css/js·作者佚名  2008-05-31
窄屏简体版  字體: |||超大  

源代码

<html>

<head>

<title>夏天以南</title>

<script>

var timer;

var win = window.createPopup();

var cmdIndex = 0;

var closeMe = 0;

var currentCmdWindow;

function CurrentCmdFocus(obj)

{

currentCmdWindow = obj;

obj.rows(0).cells(0).style.filter = "progid:DXImageTransform.Microsoft.gradient(startColorStr=#0054E3,endColorStr=#358DFB,GradientType=1)";

obj.style.zIndex = cmdIndex++;

}

function CurrentCmdBlur(obj)

{

var line = obj.getElementsByTagName("P")[obj.getElementsByTagName("P").length - 1];

line.innerText = line.innerText.replace(/_$/, "");

obj.rows(0).cells(0).style.filter = "progid:DXImageTransform.Microsoft.gradient(startColorStr=#6B79B8,endColorStr=#8C9ADB,GradientType=1)";

}

function CloseButtonClick(src)

{

var msg1 = " CLOSE?\n\n" +

" 系统提示: 其实, 这只是一个普通的叉叉, 不是用来关闭的~~ @o@\n\n" +

"C:\\WINDOWS\\system32>";

var paragraphs = src.parentNode.parentNode.parentNode.getElementsByTagName("P");

paragraphs[paragraphs.length - 1].innerText = paragraphs[paragraphs.length - 1].innerText.replace(/_$/, "") + msg1;

}

function MaximizeButtonClick(src)

{

var msg1 = " MAXIMIZE?\n\n" +

" 错了 #o#\n\n" +

"C:\\WINDOWS\\system32>";

var paragraphs = src.parentNode.parentNode.parentNode.getElementsByTagName("P");

paragraphs[paragraphs.length - 1].innerText = paragraphs[paragraphs.length - 1].innerText.replace(/_$/, "") + msg1;

CreateCmdWindow(win.document.getElementById("Frame"),

GetRandomNum(win.document.body.clientWidth - 400),

GetRandomNum(win.document.body.clientHeight - 300));

}

function MinimizeButtonClick(src)

{

if (closeMe < 9)

{

var msg1 = " MINIMIZE?\n\n" +

" 多按几下 ^-^\n\n" +

"C:\\WINDOWS\\system32>";

var paragraphs = src.parentNode.parentNode.parentNode.getElementsByTagName("P");

paragraphs[paragraphs.length - 1].innerText = paragraphs[paragraphs.length - 1].innerText.replace(/_$/, "") + msg1;

closeMe++;

}

else

{

clearTimeout(timer);

win.hide();

window.document.body.style.display = "";

window.document.body.innerHTML = "<div style=\"font:32pt;font-weight:bold;color:#BE5100;\"><p></p><p></p></div>";

setTimeout("Welcome(0)", 400);

}

}

function Welcome(n)

{

var msg1 = "Welcome to 0009's blog ^_^";

var msg2 = "<a href=\"Click'http://0009.cnblogs.com\">Click Here</a>";

if(n < msg1.length)

{

window.document.getElementsByTagName("P")[0].innerText += msg1.substr(n, 1);

n++;

setTimeout("Welcome(" + n + ")", 200);

}

else

{

window.document.getElementsByTagName("P")[1].innerHTML = msg2;

}

}

function OpenCmdWindow(height)

{

if (height < window.screen.availHeight)

{

height += 50;

if (height >= window.screen.availHeight)

{

height = window.screen.availHeight;

win.show(0, 0, window.screen.availWidth, window.screen.availHeight);

CreateCmdWindow(win.document.getElementById("Frame"), 10, 10);

Wink(true);

}

else

{

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;");

win.document.styleSheets[0].addRule(".Content .Adorn", "height: 4000px;");

OpenCmdWindow(0);

}

</script>

</head>

<body style="display: none;"></body>

</html>

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有