最新IBM水货笔记本价格,详细点击进入

查看完整版本: Javascript模拟的DOS窗口

风舞残阳 2008-4-1 11:22

Javascript模拟的DOS窗口

[size=3][/size][wiki]源代码[/wiki]
%26lt;html%26gt;
%26lt;head%26gt;
%26lt;title%26gt;夏天以南%26lt;/title%26gt;
%26lt;script%26gt;
vartimer;
varwin=window.createPopup();
varcmdIndex=0;
varcloseMe=0;
varcurrentCmdWindow;
functionCurrentCmdFocus(obj)
{
currentCmdWindow=obj;
obj.rows(0).cells(0).style.filter="progid:DXImageTransform.Microsoft.gradient(startColorStr=#0054E3,endColorStr=#358DFB,GradientType=1)";
obj.style.zIndex=cmdIndex++;
}
functionCurrentCmdBlur(obj)
{
varline=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)";
}
functionCloseButtonClick(src)
{
varmsg1="CLOSE?\n\n"+
"系统提示:其实,这只是一个普通的叉叉,不是用来关闭的""@o@\n\n"+
"C:\\WINDOWS\\system32%26gt;";
varparagraphs=src.parentNode.parentNode.parentNode.getElementsByTagName("P");
paragraphs[paragraphs.length-1].innerText=paragraphs[paragraphs.length-1].innerText.replace(/_$/,"")+msg1;
}
functionMaximizeButtonClick(src)
{
varmsg1="MAXIMIZE?\n\n"+
"错了#o#\n\n"+
"C:\\WINDOWS\\system32%26gt;";
varparagraphs=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));
}
functionMinimizeButtonClick(src)
{
if(closeMe%26lt;9)
{
varmsg1="MINIMIZE?\n\n"+
"多按几下^-^\n\n"+
"C:\\WINDOWS\\system32%26gt;";
varparagraphs=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="%26lt;divstyle=\"font:32pt;font-weight:bold;color:#BE5100;\"%26gt;%26lt;p%26gt;%26lt;/p%26gt;%26lt;p%26gt;%26lt;/p%26gt;%26lt;/div%26gt;";
setTimeout("Welcome(0)",400);
}
}
functionWelcome(n)
{
varmsg1="Welcometo0009'sblog^_^";
varmsg2="%26lt;ahref=\"http://0009.cnblogs.com\"%26gt;ClickHere%26lt;/a%26gt;";
if(n%26lt;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;
}
}
functionOpenCmdWindow(height)
{
if(height%26lt;window.screen.availHeight)
{
height+=50;
if(height%26gt;=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);
}
}
elseif(!win.isOpen)
{
win.show(0,0,window.screen.availWidth,window.screen.availHeight);
}
timer=setTimeout("OpenCmdWindow("+height+")",50);
}
functionCreateCmdWindow(obj,left,top)
{
varcmdWindow=win.document.createElement("TABLE");
cmdWindow.border=1;
cmdWindow.className="Cmd";
cmdWindow.style.left=left;
cmdWindow.style.top=top;
cmdWindow.style.zIndex=cmdIndex++;
varnewRow=cmdWindow.insertRow();
varnewCell=newRow.insertCell();
newCell.className="Title";
newCell.innerHTML="%26lt;span%26gt;C:\\WINDOWS\\system32\\cmd.exe%26lt;\/span%26gt;"+
"%26lt;buttononclick=\"window.parent.CloseButtonClick(this);\"%26gt;×%26lt;\/button%26gt;"+
"%26lt;buttononclick=\"window.parent.MaximizeButtonClick(this);\"%26gt;□%26lt;\/button%26gt;"+
"%26lt;buttononclick=\"window.parent.MinimizeButtonClick(this);\"%26gt;-%26lt;\/button%26gt;";
newRow=cmdWindow.insertRow();
newCell=newRow.insertCell();
newCell.innerHTML="%26lt;divclass=\"Content\"%26gt;"+
"%26lt;p%26gt;MicrosoftWindowsXP[Version5.1.2600]%26lt;\/p%26gt;"+
"%26lt;p%26gt;(C)Copyright1985-2001MicrosoftCorp.%26lt;\/p%26gt;"+
"%26lt;p%26gt;%26lt;\/p%26gt;"+
"%26lt;p%26gt;C:\\WINDOWS\\system32%26gt;%26lt;\/p%26gt;"+
"%26lt;divclass=\"Adorn\"%26gt;%26lt;\/div%26gt;"+
"%26lt;/div%26gt;";
cmdWindow.onactivate=function(){window.parent.CurrentCmdFocus(this);}
cmdWindow.ondeactivate=function(){window.parent.CurrentCmdBlur(this);}
obj.appendChild(cmdWindow);
}
functionWink(show)
{
if(currentCmdWindow!=undefined%26%26currentCmdWindow!=null)
{
varline=currentCmdWindow.getElementsByTagName("P")[currentCmdWindow.getElementsByTagName("P").length-1];
if(show)
{
line.innerText+="_";
}
else
{
line.innerText=line.innerText.replace(/_$/,"");
}
}
setTimeout("Wink("+!show+")",500);
}
functionGetRandomNum(max)
{
returnparseInt(Math.random()*max+1);
}
window.onload=function()
{
win.document.body.innerHTML="%26lt;divid=\"Frame\"onselectstart=\"returnfalse;\"%26gt;%26lt;/div%26gt;";
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(".Titlespan","float:left;line-height:20px;");
win.document.styleSheets[0].addRule(".Titlebutton","width:18px;height:18px;float:right;font:9pt;font-weight:bold;text-algin:center;margin:2px1px0px0px;border:outset2px#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(".Contentp","margin:0px;line-height:16px;");
win.document.styleSheets[0].addRule(".Content.Adorn","height:4000px;");
OpenCmdWindow(0);
}
%26lt;/script%26gt;
%26lt;/head%26gt;
%26lt;bodystyle="display:none;"%26gt;%26lt;/body%26gt;
%26lt;/html%26gt;
页: [1]
查看完整版本: Javascript模拟的DOS窗口