Home >Web Front-end >HTML Tutorial >Detailed explanation of important attributes of tag in html

Detailed explanation of important attributes of tag in html
黄舟
黄舟Original
2017-06-30 11:27:551545browse

archive Properties

For performance reasons, you can choose to pre-download a set of objects containing one or more archives. This is especially true for Java-based applications, where a Java class will depend on many other classes to do its job.

The value of the archive attribute is a quoted list of URLs, each of which points to an archive file that the browser needs to load before the object can be displayed or executed.

classid attribute

The classid attribute is used to specify the location of an object contained in the browser, usually a Java class.

Its value is the absolute or relative URL of the object. If the codebase attribute is provided, relative URLs are relative to the URL specified by the codebase attribute; otherwise, they are relative to the URL of the current document.

For example, to execute the time Java applet contained in the clock.class file, you can include the following code in the HTML document:

<object classid="clock.class"></object>

The browser will use the base URL of the current document as This applet looks for code. Therefore, if the URL of the current document looks like this:

http://www.w3school.com.cn/time.html

The browser will get the applet code for our clock.class instance at the following address:

http://www.w3school.com.cn/clock.class

Tip: The classid attribute is the same as 1f4c1478f5db8d1b3a5ebed12c268173 tag is similar, providing the name of the file containing the object.

codebase attribute

The codebase attribute is an optional attribute that provides a base URL. The value of this attribute is a URL that points to the directory containing the object referenced by the classid attribute. The codebase URL overrides the document's base URL, but does not permanently replace it. This base URL is the default if the codebase attribute is not used.

Now, we continue to use the previous example, assuming that the document comes from http://www.w3school.com.cn, but the clock applet is placed in a separate directory called classes. This applet cannot be obtained by specifying classid= "classes/clock.class". Instead, you need to include the codebase attribute and the new base URL:

<object classid="clock.class" codebase="http://www.w3school.com.cn/classes/">
</object>

This line of statement parses to this URL:

http://www.w3school.com.cn/classes/clock.class

Although we used an absolute URL in this example, in practice Relative URLs can also be used. For example, applets are often stored on the same server as the host document. Therefore, for the sake of relocation, it is often better to specify a relative URL for the codebase, such as:

<object classid="clock.class" codebase="/classes/">
</object>

Tip: From the above As you can see in a few examples, the codebase attribute is used in conjunction with the classid attribute to specify the full URL of the object.

codetype attribute

The codetype attribute is used to identify the program code type.

The codetype attribute is only needed if the browser cannot determine the applet's MIME type based on the classid attribute, or if the server does not transmit the correct MIME type when downloading an object.

The codetype attribute is similar to the type attribute. The difference is that it is used to identify the program code type, while the type attribute is used to identify the data file type.

The following example explicitly tells the browser that the object's code is Java:

<object codebase="clock.class" codetype="application/java">
</object>

declare

Attribute declare attribute can define an object. But it also prevents the browser from downloading and processing it.

When used with the name attribute, this tool is similar to some kind of forward declaration in more traditional

programming languages

, such a declaration can delay the download of the object until the object It is indeed used in the documentation. data attribute

The data attribute specifies the URL of the data file for the object to process.

The value of this attribute is the URL of the file, which may be an absolute or relative URL relative to the file's base URL, or an absolute or relative URL relative to the URL provided with the codebase attribute.

The browser determines the type of data by the type of object inserted into the document.

This attribute is similar to the src attribute in the a1f02c36ba31691bcfe87b2722de723b tag in that it downloads the data to be processed by the containing object. The difference, of course, is that the data attribute allows the inclusion of almost any file type, not just image files.

The above is the detailed content of Detailed explanation of important attributes of tag in html. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn