Javascript Quick Start Guide
Step 1: Download the Javascript API and unzip it to a
development directory. You should have the following files:
jsapi2\WiiRemote.js
jsapi2\Utilities.js
game.html
Step 2: Create a file in the same directory called main.js
and open it in your favorite text editor. (Notepad will do.) Make sure
the filename is exact!
Step 3: First, let's place an object on the screen. Enter
the following text into your text editor:
var textfield = document.createElement("input");
document.body.appendChild(textfield);
Save the file. We can test the code you've written by opening game.html
in a web browser. The result should look something like this:

Step 4: Now we can add the main loop. Open main.js
in your text editor and add the following code to it:
function mainLoop()
{
if(Wii.getPrimaryRemote().isDown(WiiRemote.BUTTON_1))
{
textfield.value = "Button 1 pressed!";
}
}
setInterval("mainLoop()", 100);
Save the file and open game.html in your web browser. The screen
will look the same until you press the 'a' key on the
keyboard. Then the textbox will fill with the text "Button 1
Pressed!" You can also deploy the files to your favorite web
server and test the code on the Wii. Simply press the '1'
button on the Wii rather than the 'a' button.

Step 5: That's it! You've just created your first Wii Remote program!