Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Object and EMBED tags in html

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

It is believed that many inexperienced people have no idea about how to use Object and EMBED tags in html. Therefore, this article summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

Definition and usage

Define an embedded object. Use this element to add multimedia to your XHTML page. This element allows you to specify data and parameters for objects inserted into an HTML document, as well as code that can be used to display and manipulate the data.

Tags are used to contain objects such as images, audio, video, Java applets, ActiveX, PDF, and Flash.

Object was originally intended to replace img and applet elements. However, this has not been realized due to vulnerabilities and lack of browser support.

The object support of the browser depends on the object type. Unfortunately, mainstream browsers use different code to load the same object type.

Fortunately, the object object provides a solution. If the object element is not displayed, the code between and is executed. In this way, we can nest multiple object elements (each corresponding to a browser).

Use object (OBJECT) and embedded (EMBED) tags

In order for Flash movies to be played in a browser, the HTML document must contain and tags and set parameters. For the EMBED tag, the settings enclosed with it in parentheses (such as HEIGHT, WIDTH, QUALITY, LOOP, etc.) are its properties, such as:

The OBJECT tag has four settings (HEIGHT, WIDTH, CLASSID and CODEBASE), all of which are its attributes. Other settings appear independently in the HTML document, called parameter tags. For example:

SRC

Value: movie name (such as movieName.swf).

Corresponding template variable: $MO

Function description: specifies the name of the movie to be loaded, which applies only to the "EMBED" flag.

MOVIE

Value: movie name (such as movieName.swf).

Corresponding template variable: $MO

Function description: specifies the name of the movie to be loaded, which applies only to the "OBJECT" flag.

CLASSID

Value: clsid:D27CDB6E-AE6D-11cf-96B8-444553540000

Function description: indicates that the ActiveX control used by the browser must be exactly the same as the above value and is only applicable to the "OBJECT" flag.

WIDTH

Value: number or percentage.

The corresponding template variable: $WI.

Function description: specifies the width of the movie as a percentage of the number of pixels or browser window width.

HEIGHT

Value: number or percentage.

Corresponding template variable: $HE

Function description: specifies the height of the movie as a percentage of the number of pixels or browser window height.

Because the Flash movie is scalable, changing the size of the movie format while maintaining the aspect ratio will not reduce the display quality of the movie.

CODEBASE

Value: http://active.macromedia.com/flash5/cabs/swflash.cab

# version=4,0,0,0 "

Function description: indicates the location of the ActiveX control of the Flash player, which can be downloaded automatically when the browser does not install it. The assigned value must be exactly the same as the above value. Applies only to the "OBJECT" flag.

PLUGINSPAGE

Value: http://www.macromedia.com/shockwave/download/ index.cgi?

P1_Prod_Version=ShockwaveFlash

Function description: indicates the location of the Flash player plug-in, which is easy to install when needed. The assigned value must be exactly the same as the above value. Applies only to the "EMBED" flag.

SWLIVECONNECT (optional)

Value: true or false.

Function description: used to determine whether to start Java when the Flash player is loaded for the first time, and take the default value False when the item is omitted. Whenever you include a JavaScript program and a Flash in the same page, you must run Java in order for the "FS Commands" statement to work, but if the JavaScript program on the page is only used to monitor the type of browser or other functions that have nothing to do with the "FS Commands" statement, you can set SWLIVECONNECT to false to prevent Java from starting, and to start Java, you can explicitly set SWLIVECONNECT to true, which will greatly increase the time it takes for the movie to start the playback process. Applies only to the "EMBED" flag.

PLAY (optional)

Value: true or false.

The corresponding template variable: $PL.

Function description: used to specify whether the movie will be played immediately after it is downloaded to the browser. If the movie contains interactive elements, you may need the presenter's action to start playback, so you can set this property to false to prevent automatic playback of the movie. When this attribute is omitted, it will be executed by the default value of true.

LOOP (optional)

Value: true or false.

The corresponding template variable: $LO.

Function description: specify whether the movie is played repeatedly or stopped after one play. When this property is omitted, it is executed at the default value of true.

QUALITY (optional)

Value: low, high, autolow, autohig or best.

The corresponding template variable: $QU.

Function description: see above.

When this property is omitted, it is executed at the default value of high.

BGCOLOR (optional)

Value: # RRGGBB (hexadecimal RGB value).

Corresponding template variable: $BG

Specifies the background color of the movie, which replaces the background color setting in the Flash movie file, but does not affect the background color setting of the HTML page on which the movie is located.

SCALE (optional)

Values: showall, noborder, exactfit.

The corresponding template variable: $SC.

Function description: determines how the movie is placed in the browser window when the width and height values are expressed as a percentage. There are the following options:

"Show all" (default) displays the content of the entire movie in an area of the specified size and maintains the same aspect ratio as the original movie, and the content of the movie is not deformed.

"No Border" fills the specified area while maintaining the aspect ratio of the movie, the content of the movie is not deformed, but part of the content of the movie may not be displayed.

"Exact Fit" makes the entire movie visible in a specified area, because the original aspect ratio is no longer maintained, so the film may be deformed.

When this property is omitted (and the width and height values are expressed as a percentage), the default value, showall, is executed.

ALIGN

Values: l, R, T, B.

The corresponding template variable: $HA.

Function description: set the "ALIGN" attribute in the "OBJECT", "EMBED" and "IMG" tags to determine the location of the movie in the browser window.

When omitted, place the movie in the center of the browser window, and if the size of the browser window is smaller than the area occupied by the movie, the browser window will be resized so that the movie is displayed properly.

The "L" value aligns the movie with the left side of the browser window, and if the browser window is not large enough to accommodate the movie, the upper and lower edges and the right side of the window will be adjusted.

The "R" value aligns the movie with the right side of the browser window, and if the browser window is not large enough to accommodate the movie, it adjusts the top and bottom and left side of the window.

The "T" value aligns the movie with the top edge of the browser window, and if the browser window is not large enough to accommodate the movie, the left and right and bottom edges of the window are adjusted.

The "B" value aligns the movie with the bottom edge of the browser window, and if the browser window is not large enough to accommodate the movie, the left and right and top edges of the window are adjusted.

SALIGN (optional)

Values: l, R, T, B, TL, TR, BL, BR.

Corresponding template variable: $SA

Function description: used to determine how the scaled movie is placed in an area of a specified width and height size. The meaning of the various values can be found in the previous item.

BASE (optional)

Value: base path or URL.

Function description: used to specify the base location of the relative path used in the movie.

MENU (optional)

Values: true, false.

The corresponding template variable: $ME.

Function description: lets you specify the type of shortcut menu that appears in the browser when you right-click the area occupied by the movie (for Windows) or hold down the "command" button (for Macintosh).

The "True" value displays the entire menu, allowing the presenter to have multiple controls over the screening process.

The "False" value displays menus that contain only "About Flash" menu items.

When this property is omitted, it is executed at the default value of "true".

WMODE (optional)

Values: Window, Opaque, Transparent.

The corresponding template variable: $WM.

Function description: this parameter is only applicable in Windows systems with Flash Active X space.

The "Window" value allows the movie to be played at the specified location on the web page, which is the fastest of several options.

The "Opaque Windowless" value blocks the content behind the movie on the web page.

The "Transparent" value makes the transparent part of the movie on the web page show the content and background of the web page, which may slow down the animation.

When this attribute is omitted, it is executed at the default value of "Window" and can only be used in Object tags.

1. Introduction:

For flash content to be displayed properly on a web page, there must be a label in the page that specifies the flash path. That is, OBJECT and EMBED tags. The OBJECT tag is for IE browsers on windows platforms, while EMBED is used for Netscape Navigator browsers on windows and Macintosh platforms and IE browsers on Macintosh platforms. IE on the windows platform uses Activex controls to play flash, while other browsers use Netscape plug-in technology to play flash.

The following is a simple code example of inserting flash into a web page:

The code is as follows:

Second, why use all the above tags? Can you omit some tags?

The OBJECT tag is used for windows IE3.0 and future browsers or other browsers that support Activex controls. The "classid" and "codebase" attributes must be written exactly as shown in the example above, telling the browser the address to download flash player automatically. If you have not installed flash player, then browsers after IE3.0 will pop up a prompt to see if you want to install flash player automatically. Of course, if you don't want users who don't have flash player installed to download the player automatically, maybe you can omit the code.

The EMBED tag is used for Netscape Navigator2.0 and future browsers or other browsers that support Netscape plug-ins. The "pluginspage" attribute tells the browser where to download flash player, and if flash player is not already installed, the user needs to restart the browser after installation.

To ensure that most browsers display flash properly, you need to nest EMBED tags within OBJECT tags, as in the above code example. Browsers that support Activex controls will ignore the EMBED tags within the OBJECT tag. Netscape and IE browsers that use plug-ins will only read EMBED tags and will not recognize OBJECT tags. In other words, if you omit the EMBED tag, firefox will not recognize your flash (but wonder if you omit object and only write embed,IE can display flash properly, hehe, take a closer look at it).

The necessary and optional attributes for the OBJECT and EMBED tags used to publish the movie are listed below.

1. Required attributes:

CLASSID- sets the Activex control of the browser for OBJECT tags only.

CODEBASE- sets the location of the flash Activex control so that it can be downloaded and installed automatically if the browser is not installed. For OBJECT tags only.

WIDTH- specifies the width of the flash movie as a percentage or in pixels.

HEIGHT- specifies the height of the flash movie as a percentage or in pixels.

SRC- specifies the download address of the movie. For EMBED tags only.

PLUGINSPAGE- sets the location of the flash plug-in so that it can be downloaded and installed automatically if the browser is not installed. For EMBED tags only.

MOVIE- specifies the download address of the movie. For OBJECT tags only.

2. Optional attributes and available values:

ID- sets the variable name, which is used for references to script code. For OBJECT only.

NAME-sets the variable name for references to script code such as javascript. For EMBED only.

SWLIVECONNECT-(true or false) specifies whether java is enabled when flash player is downloaded for the first time. If some properties are omitted, the default value is false. If you use javascript and flash,java on the same page, you must use FSCommand to work.

PLAY-(true or false) specifies whether the flash movie plays automatically after the download is complete, and if this property is omitted, it defaults to true.

LOOP-(true or false) specifies whether the movie stops or continues to loop after the last frame, and if this property is omitted, it defaults to true.

MENU-(true or false)

True displays all the menus, allowing users to zoom in and out to control movie playback and other operations.

The False display contains only settings options and menus about flash.

QUALITY-(low, high, autolow, autohigh, best)

Low is faster than beautiful and does not use anti-aliasing.

Autolow initially focused on speed, but always improved its beauty when needed.

Autohigh also focuses on playing speed and beauty, but sacrifices beauty to ensure playback speed when needed.

Medium applies some anti-aliasing and uneven bitmaps. Its quality is higher than the low setting and lower than the high setting.

High is more beautiful than playback speed and uses anti-aliasing all the time. If the movie does not contain animation, the bitmap is smoothed, while if the movie contains animation, the bitmap remains smooth.

Best provides the best display quality regardless of playback speed. All output is anti-aliased and all bitmaps are smoothed.

SCALE-(showall, noborder, exactfit)

The Default (Show all) movie is displayed in the specified area, but maintains the original scale. Borders will appear on both sides of the film.

No Boder shrinks the movie to fit the specified area, keeping the movie undistorted, but some movies will probably be trimmed. However, maintain the original proportion of the film.

Exact Fit makes the entire movie display in a specified area, the movie may be deformed and distorted, and does not maintain the original scale.

ALIGN-(l, t, r, b)

The default is centered, and the edges will be trimmed when the browser window is smaller than the movie.

The Left,Right,Top,Bottom is aligned along the edge of the browser according to the appropriate settings. If necessary, the other three sides will be cut.

SALIGN-(l, t, r, b, tl, tr, bl, br)

L,R,T,B

TL,TR

BL,BR

WMODE- (window, opaque, transparent) sets the window mode property of the flash movie and specifies the transparency, cascading and location of the flash in the browser.

The Window movie plays in its own rectangular window in the browser.

The Opaque movie hides everything behind it.

Transparent makes the flash movie transparent, displaying the web content behind the transparent movie. This will degrade the performance of the animation. And this property is not available in all browsers.

BGCOLOR-(# RRGGBB, hexadecimal RGB value. Specifies the background color of the movie Use this property to override the background color set in flash.

BASE-sets the base directory or URL to resolve the relative paths in all flash. Similar to the tags in a web page.

FLASHVARS passes variables to flash player, which requires flash player6 and later versions.

Pass root-level variables to the movie. The format of the string is a set of name=value separated by "&".

Browsers support string lengths of 64kB size.

After reading the above, have you mastered how to use Object and EMBED tags in html? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report