JavaScript Source Code 3000: Games: Mr. Potato Head
Mr. Potato Head
Play a good old game of Mr. Potato Head - powered by JavaScript, of course! Click buttons to change the hair, eyes, nose, and mouth! And, click the "View It" button to see Mr. Potato Head!
JavaScript Source Code 3000: Games: Mr. Potato Head
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 NotePad or SimpleText) and save (Control-s or Apple-s). The script is yours!
<!-- ONE STEP TO INSTALL MR. POTATO HEAD:
1. Add the first code to the BODY of your HTML document -->
<!-- STEP ONE: Add the first code to the BODY of your HTML document -->
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Michael Tartaglia (stonedstan@hotmail.com) -->
<!-- Web Site: http://www.geocities.com/SiliconValley/Horizon/5235 -->
<! >
<! >
<!-- Begin
var h=0,e=0,n=0,m=0;
var hChose="", eChose=":", nChose="-", mChose=")";
document.write("<FORM NAME=\"theForm\"><CENTER>"
+ "<input type=text size=20 name=face>"
+"<BR><input type=button value=Hair onClick='changeHair()'>"
+"<input type=button value=Eyes onClick='changeEyes()'>"
+"<input type=button value=Nose onClick='changeNose()'>"
+"<input type=button value=Mouth onClick='changeMouth()'> ");
document.write("<input type=button value=View onClick='viewIt()'>");
document.write("</CENTER></FORM>");
document.theForm.face.value=hChose+" "+eChose+" "+nChose+mChose;
hair=new Array("","[[[","2","3","(","\\/\\/","Ç");
eyes=new Array("B",":\'",">:","<:",":",";","Åš");
nose=new Array("- ","^ ","* ","~ ","Å„ ","");
mouth=new Array("Þ","O","}","|",")","(",")~~",")===");
function changeHair() {
if (h == 6) {h=0} else (h++)
hChose = hair[h];
document.theForm.face.value=hChose+" "+eChose+" "+nChose+mChose;
}
function changeEyes() {
if (e == 6) {e=0} else (e++)
eChose = eyes[e];
document.theForm.face.value=hChose+" "+eChose+" "+nChose+mChose;
}
function changeNose() {
if (n == 5) {n=0} else (n++)
nChose = nose[n];
document.theForm.face.value=hChose+" "+eChose+" "+nChose+mChose;
}
function changeMouth() {
if (m == 7) {m=0} else (m++)
mChose = mouth[m];
document.theForm.face.value=hChose+" "+eChose+" "+nChose+mChose;
}
function viewIt() {
mth="";
for (i=1;i<=mChose.length;i++) {mth += mChose.charAt(i)}
see=window.open('','','width=200,height=175,toolbar=no,status=no,scrolling=no');
see.document.write("<HTML><HEAD><TITLE>Mr. Potato Head</TITLE></HEAD><BODY>"
+ "<CENTER><FONT SIZE=7><B>"+hChose+" <FONT COLOR=blue>"
+ eChose + " </FONT>" + nChose + " <FONT COLOR=red>"
+ mChose.charAt(0) + "</FONT>" + mth + "</B></FONT><br><br>"
+ "<FONT SIZE=2><I>Mr. Potato Head!</I></FONT><br>"
+ "<FONT SIZE=1>(<a href=\"javascript:this.close()\">"
+ "close</a>)</FONT></CENTER></BODY></HTML>");
}
// End -->
</script>
<!-- Script Size: 2.49 KB -->
Wyszukiwarka
Podobne podstrony:
Beach Head Desert War infoThe Soup Nazi s« Cream of Sweet Potato SoupNORSE WOMANS LINEN HEAD DRESSMicroactuator for Precise Head PositioningheadLone Star Steakhouse« Baked Sweet Potatoheadwięcej podobnych podstron