<html>
<head>
<center>
<FORM name="history">
<INPUT name="command" type="text" value="">
<INPUT type="button" value="adicionar" onclick="f_store(document.history.command.value)">
<INPUT name="history" type="button" value="mostrar" onclick="f_print()">
</FORM>
</head>
<body>
<SCRIPT language="JavaScript">
<!--
function MakeArray( n ) {
if( n <= 0 ) {
this.length = 0;
return this;
}
this.length = n;
for( var i = 1; i <= n; i++ ) {
this[ i ] = 0;
}
return this;
}
var history = new MakeArray( 15 );
var index = 0;
var cmmnd = 1;
function f_store( sTR ) {
var i;
if( index >= history.length ) {
for( i = 1; i < history.length; i++ )
history[i-1] = history[i];
index = history.length - 1;
}
history[ index ] = cmmnd + ":" + sTR;
++cmmnd;
++index;
document.history.command.value="";
}
function f_print() {
var allCmmnds, i;
allCmmnds = "";
for( i = 0; i < index; i++ )
allCmmnds += history[i] + "n";
alert( allCmmnds );
}
//-->
</SCRIPT>
</center>
</body>
</html>