MCCC CIS 177 - Markup Languages

Java Applets

The <applet> tag

Java is a programming language that allows users to download applications that run locally. A Java program is called an applet. The applet itself is an external file that is embedded as an object into your HTML code. To write your own Java applets, you need the Java Developer's Kit (JDK). Java source files have the .java extension, but must be compiled into a .class file, which can only be run with the Java interpreter installed as a plug-in. To embed an applet into your code, you use the <applet> tag, which contains one or more <param> tags depending on the nature of the applet:

<applet code="file" other attributes>
<param>
<param>
</applet>

Embed the <applet> tag

Open credits.txt from the downloaded lab files.

Copy all the text in the file.

Open raintxt.htm. Replace the text in the <div class="weather"> with the copied code.

Save the file and open it in the browser.

The <marquee> and <object> tags

<marquee>

The <marquee> tag is supported by IE 3.0 and higher. You can use this tag to achieve similar results:

Edit raintxt.htm and add the following code:

<marquee bgcolor="#FFFFFF" scrolldelay="10" scrollamount="1" direction="up" width="400" heigh="60">

<div style="color:#663366; font-size=12pt; text-align:center; font-family: Times New Roman">
TODAY'S WEATHER FORECAST<br><br>
Today ... Partly sunny.<br>
Tonight ... partly cloudy. Showers with sleet.<br>
<a href="http://www.nps.gov/mora/weather.htm">Click to view the weather page.</a>
</div>
</marquee>

Save and view the file.

<object> tag

You can use the <object> tag to embed sound and video clips, applets and images.

Edit raintxt.htm to embed the Java applet using the <object> tag:

<object classid="java:CreditRoll.class" width="400" height="60">
<param name="BGCOLOR" value="FFFFFF">
<param name="TEXTCOLOR" value="663366">
<param name="FADEZONE" value="20">
<param name="FONT" value="TIMES NEW ROMAN">
<param name="TEXT1" value="TODAY'S WEATHER FORECAST">
<param name="TEXT2" value=" ">
<param name="TEXT3" value="TODAY...Partly sunny.">
<param name="TEXT4" value="TONIGHT...Partly cloudy. Showers with sleet.">
<param name="TEXT5" value="TUESDAY...Rain heavy at times. Snow likely.">
<param name="TEXT6" value="WEDNESDAY...Clearing.">
<param name="TEXT7" value=" ">
<param name="TEXT8" value="Click to view the Weather Page.">
<param name="URL" value="http://www.nps.gov/mora/current/weather.htm">
<param name="REPEAT" value="yes">
<param name="SPEED" value="100">
<param name="VSPACE" value="3">
<param name="FONTSIZE" value="12">
</object>

Save and view the file.

To nest the <object> tag, add the following code:

<object data="mrim.mpg" type="video/mpeg">
    <object data="mrim.mov" type="video/quicktime">
        <object data="mrim.avi" type="video/x-msvideo">
               <img src="mrim.jpg">
        </object>
    </object>
</object>

Save and view the file.