Weird Widgets Weird Widgets Weird Widgets Weird Widgets
Weird Widgets Weird Widgets Weird Widgets Weird Widgets

     The Joys of Java The Joys of Java The Joys of Java The Joys of Java The Joys of Java

       
  What is Java? Wilipedia   Is Java active on my computer?  
         
 

What's the difference between Java and an Applet?

"An applet is a program written in the Java programming language that can be included in an HTML page, much in the same way an image is included in a page. When you use a Java technology-enabled browser to view a page that contains an applet, the applet's code is transferred to your system and executed by the browser's Java Virtual Machine (JVM). For information and examples on how to include an applet in an HTML page, refer to this description of the <APPLET> tag." http://java.sun.com/applets/ 


 
   
  How do you use copyright free Java Code with your HTML?  
 
  •   search to find (try the search "JAVA script source code for games")

  •   follow instructions author provides

  •   place in code correctly

  •   verify it "works"

  •   try, try again!


Java Project 1: JavaScript Webpage

Create 2 (or more, as needed) linked web pages containing Java imbedded in your HTML code.  The Java must be something that could be classified as having to do with each of the following categories:

Name _________________________________________________________

q       Mouse

q       Game

q       Numbers

q       Text

q       Generator 

q       Your Creative Choice

 
 

 

100 Beautifully presented, fabulous job!

97  All there, presentation lacking

84  Missing 1,   68 Missing 2,   52 Missing 3,    36 Missing 4, 20  Missing 5

 
  "Round-Robin" grading (yes, others want to see what you have found!)  

 

 
 For example, try these codes...See the whole project!

Color changing background.  Slow, subtle change.  Very nice.

 

Copy and Paste in Head

<script language="JavaScript">
<!--
//you can assign the initial color of the background here
r=255;
g=255;
b=255;
flag=0;
t=new Array;
o=new Array;
d=new Array;

function hex(a,c)
{
t[a]=Math.floor(c/16)
o[a]=c%16
switch (t[a])
{
case 10:
t[a]='A';
break;
case 11:
t[a]='B';
break;
case 12:
t[a]='C';
break;
case 13:
t[a]='D';
break;
case 14:
t[a]='E';
break;
case 15:
t[a]='F';
break;
default:
break;
}
switch (o[a])
{
case 10:
o[a]='A';
break;
case 11:
o[a]='B';
break;
case 12:
o[a]='C';
break;
case 13:
o[a]='D';
break;
case 14:
o[a]='E';
break;
case 15:
o[a]='F';
break;
default:
break;
}
}

function ran(a,c)
{
if ((Math.random()>2/3||c==0)&&c<255)
{
c++
d[a]=2;
}
else
{
if ((Math.random()<=1/2||c==255)&&c>0)
{
c--
d[a]=1;
}
else d[a]=0;
}
return c
}
function do_it(a,c)
{
if ((d[a]==2&&c<255)||c==0)
{
c++
d[a]=2
}
else
if ((d[a]==1&&c>0)||c==255)
{
c--;
d[a]=1;
}
if (a==3)
{
if (d[1]==0&&d[2]==0&&d[3]==0)
flag=1
}
return c
}
function disco()
{
if (flag==0)
{
r=ran(1, r);
g=ran(2, g);
b=ran(3, b);
hex(1,r)
hex(2,g)
hex(3,b)
document.bgColor="#"+t[1]+o[1]+t[2]+o[2]+t[3]+o[3]
flag=50
}
else
{
r=do_it(1, r)
g=do_it(2,g)
b=do_it(3,b)
hex(1,r)
hex(2,g)
hex(3,b)
document.bgColor="#"+t[1]+o[1]+t[2]+o[2]+t[3]+o[3]
flag--
}
if (document.all)
setTimeout('disco()',50)
}
//-->
</script>

 

Copy and Paste in Body

<body onload="disco()" style="text-align: center">