<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication.WebForm1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://w...content-available-to-author-only...3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://w...content-available-to-author-only...3.org/1999/xhtml">
<head runat="server">
<script type="text/javascript">
function keyPressed(e) {
var code;
if (window.event) {
//IE
code = e.keyCode;
}
else {
//other browsers
code = e.which;
}
//check, for example, if the Enter key was pressed (code 13)
if (code == 13) {
//Enter key pressed
handleCommand();
}
else {
//Another key pressed
}
}
function handleCommand() {
var consoleInput = this.document.getElementById('consoleBody');
var consoleOutput = this.document.getElementById('consoleOutput');
consoleOutput.innerText = "";
switch (consoleInput.value) {
case "dir":
makeServerCall("dir");
break;
default:
consoleOutput.innerText = "wrong command";
break;
}
consoleInput.value = "";
}
function makeServerCall(command) {
var xmlhttp;
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
}
else {
// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET", "WebForm1.aspx?" + command);
xmlhttp.send();
}
</script>
<title></title>
</head>
<body style="background-color: Black"; onload="javascript:this.document.getElementById('consoleBody').focus();">
<form id="form1" runat="server">
<p>
<label id="consoleHead" style="color: White; font-size: large; background-color: Black;"
runat="server" />
</p>
<p>
<textarea id="consoleBody" onkeypress="javascript:keyPressed(event);"
rows="30" cols="30" style="height: 100%; width: 100%; color: White;
font-size: large; background-color: Black; border-bottom-style: none;
border: 0px; overflow: hidden; text-align: left;" runat="server" />
</p>
<p>
<label id="consoleOutput" style="color: White; font-size: large; background-color: Black;"
runat="server" />
</p>
</form>
</body>
</html>