Javascript模拟的DOS窗口代码实例
2008-02-23 08:08:28来源:互联网 阅读 ()
源代码
<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> 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> <\/p>"
"<p>C:\\WINDOWS\\system32><\/p>"
"<div class=\"Adorn\"><\/div>"
"</div>";
cmdWindow.onactivate = function (){ window.parent.CurrentCmdFocus(this); }
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash