<applet>

HTML <applet> Tag

The <applet> tag was used to define an embedded Java applet. The use of Java applets is now deprecated as most browsers no longer support the use of plug-ins, including the Java plug-in.

The <applet> element can contain other HTML tags and text between its opening and closing tags.

Some browsers still support the <applet> tag, but they require additional plug-in or installations to work.

This element is a deprecated HTML tag in HTML 4.01 and is entirely obsolete in HTML5. Use the <object> or <embed> element instead.

Syntax

Syntax (语法)

The <applet> tag comes in pairs. The content is written between the opening (<applet>) and closing (</applet>) tags.

Example of the HTML <applet> tag:

<!DOCTYPE html>
<html>
 <head>
   <title>Title of the document</title>
 </head>
 <body>
   <applet code="game.class" align="left" archive="game.zip" height="250" width="350">
     <param name="difficulty" value="easy">
     <b>You need Java to play this game.</b>
   </applet>
 </body>
</html>

Result

Example of the HTML <object> tag used as a replacement for the <applet> tag:

<!DOCTYPE html>
<html>
 <head>
   <title>Title of the document</title>
 </head>
 <body>
   <object codetype="application/java" classid="java:programmingtutorials.class" height="200" width="200">Programming Tutorials</object>
 </body>
</html>

Attributes

Attributes (属性)

AttributeValueDescription
alignleft righttopbottommiddlebaselineIs used to position the applet according to other elements.
alttextIs used to create an alternate text for the applet.
archiveURLIs used to define the archive file’s location.
codeURLIs used to define the Java applet’s name.
objectnameIs used to define a reference to a serialized representation of an applet.
codebaseURLGives a relative base URL for applets specified in the code attribute.
heightpixelsDefines the height of the applet.
hspacepixelsIs used to define the horizontal space around the applet.
namenameIs used to give a name for the applet.
vspacepixelsIs used to define vertical space around an applet.
widthpixelIs used to define the width of an applet.


请遵守《互联网环境法规》文明发言,欢迎讨论问题
扫码反馈

扫一扫,反馈当前页面

咨询反馈
扫码关注
返回顶部