items list




JavaScript Source Code 3000: Forms: Items List





























Items List








Javascript can remember a list of several items you enter. Just enter an item and click 'Add to List'. When you are finished, click 'Show List' to see the entries.



















JavaScript Source Code 3000: Forms: Items List
Simply click inside the window below, use your cursor to highlight the script, and copy (type Control-c or Apple-c) the script into a new file in your text editor (such as Note Pad or Simple Text) and save (Control-s or Apple-s). The script is yours!!!




    





<!-- ONE STEP TO INSTALL ITEMS LIST:

1. Copy the last code into the BODY of your HTML document -->

<!-- STEP ONE: Add this code into the BODY of your HTML document -->

<BODY>

<CENTER>
<FORM name="history">

<! >
<! >

<INPUT name="command" type="text" value="">
<INPUT type="button" value="Add to List" onclick="f_store(document.history.command.value)">
<INPUT name="history" type="button" value="Show List" onclick="f_print()">
</FORM>
<P>
<SCRIPT language="JavaScript">
<!-- hide it ...
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 );
}
// End -->
</SCRIPT>



<!-- Script Size: 1.30 KB -->











Wyszukiwarka

Podobne podstrony:
items popup list
show list
track list
anonymous ftp sites list nl 2
anonymous ftp sites list org 7
List motywacyjny
Benedykt XVI 2007 07 07 list apostolski Summorum Pontyficum instr
list motywacyjny prosty informacja uzyskana od znajomych2
15 Język Instruction List Układy sekwencyjne Działania na liczbach materiały wykładowe
anonymous ftp sites list pl 2
2806 flash list 070709 Hynix MLC 2Plane
anonymous ftp sites list?u 5

więcej podobnych podstron