HTML, XHTML, and CSS, Sixth Edition

Java applets are little applications (hence the term applets) that can run in your browser to create special effects on your page, like clocks, calculators, and interactive events. There are whole books devoted to Java; here we'll restrict the topic to how to insert applets on your page once you've written or copied them from another source.

To insert an applet:

1.

Type <object codetype="application/ java" class, where file.class is the name of the applet you want to embed.

2.

Then type width="w" height="h", where w and h are the applet's size in pixels.

3.

Close the opening object tag with >.

4.

Include any parameters, with <param name="parameter" value="value_of_parameter" />.

5.

Finally, type </object> to finish.

Figure 18.56. This applet doesn't have any parameters to adjust. Everything is in the opening object tag.

Figure 18.57. Applets let you create interactive, multimedia effects on your page without having to know how to program or script.

Tips

  • You can get more information about Java applets at: http://java.sun.com/applets/.

  • You don't need to know Java to be able to use applets on your page.

  • You can also use the deprecated, but still supported applet element to embed Java applets on a page: <applet code="applet.class" width="w" height="h"><param name="param_name" value="param_value" /></applet>, where applet.class is the name of the applet to be embedded and the other values are the same as described above.

Категории