The object tag in HTML is detailed

Source: Internet
Author: User

Definition and usage

The object tag defines an embedded objects. Please use this element to add multimedia to your XHTML page. This element allows you to specify the data and parameters for inserting objects in an HTML document, as well as code that can be used to display and manipulate the data.


<object> tags are used to include objects, images, audio, video, Java applets, ActiveX, PDF, and Flash.

Object was originally intended to replace the IMG and applet elements. This is not true, however, due to vulnerabilities and lack of browser support. Object support for the browser depends on the object type. Unfortunately, mainstream browsers use different code to load the same object type. Fortunately, object objects provide a solution. If the object element is not displayed, the code between <object> and </object> is executed. In this way, we can nest multiple object elements (each corresponding to a browser).


working with Object (objects) and embedding (EMBED) tags

To play the Flash movie in a browser, the HTML document must contain and label it, and set the parameters. For embed tags, the settings that are enclosed in parentheses (such as height, WIDTH, quality, loop, and so on) are its properties, such as:

<embed src= "moviename.swf" width= "" "height=" "play=" true "loop=" true "quality=" High "pluginspage="/http Www.macromedia.com/shockwave/download/index.cgi? P1_prod_version=shockwaveflash "> </EMBED>

The OBJECT tag has 4 settings (HEIGHT, WIDTH, ClassID, and CodeBase), all of which are its properties. Other settings appear independently in HTML documents, which are called parameter labels. For example:

<object classid= "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width= "height=" "codebase="/http active.macromedia.com/flash4/cabs/swflash.cab#version=4,0,0,0 ">         <param name=" MOVIE "VALUE=" moviename.swf ">         <param name=" PLAY "value=" true ">         <param name=" LOOP "value=" true ">        < PARAM name= "Quality" value= "High" >     


SRC Value: The name of the movie (such as moviename.swf). Corresponding template variable: $MO function Description: Specifies the name of the movie to be loaded and 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, only applicable to the "OBJECT" flag.
CLASSID : clsid:d27cdb6e-ae6d-11cf-96b8-444553540000 function Description: Indicates that the ActiveX control used by the browser must be exactly the same as the value above, only for "OBJECT" Flag.
WIDTH Value: A number or a percentage. The corresponding template variable: $WI. Function Description: Specifies the width of the movie in pixels or as a percentage of the width of the browser window.
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 the height of the browser window.


Because Flash movies are scalable, changing the size of the movie format without maintaining the aspect ratio will reduce the quality of the movie's display.


CODEBASE Value: Http://active.macromedia.com/flash4/cabs/swflash.cab #version =4,0,0,0 " Description: Indicates the location of the ActiveX control for the Flash Player and can be downloaded automatically to that location when the browser does not have it installed. The assigned value must be exactly the same as the value above. 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 and is easy to install when needed. The assigned value must be exactly the same as the value above. Applies only to the "EMBED" flag.


swliveconnect(optional) value: TRUE or FALSE. Function Description: Used to determine whether Java is started when the Flash Player is first loaded, and the default value False when the item is omitted. Whenever you include a JavaScript program and flash on the same page, you must run Java for the "FS Commands" statement to work, but if the JavaScript program in the page is used only to implement the type of monitoring browser or other with the "FS Commands "statement-independent functionality, you can set Swliveconnect to False to prevent Java from starting, to start Java, you can explicitly set Swliveconnect to true, which greatly increases the time it takes to start the playback process. Applies only to the "EMBED" flag.


PLAY ( optional) value: TRUE or FALSE. Corresponding template variable: $PL. Function Description: Lets you specify whether the movie will play immediately after it is downloaded to the browser. If the movie contains interactive elements and may need to be started by a presenter's actions, you can set the property to False to prevent the movie from automatically playing, and the property is omitted when it is executed by the default value of True.


LOOP(optional) value: TRUE or FALSE. The corresponding template variable: $LO. Function Description: Specifies whether the movie repeats or stops after it is played again. When this property is omitted, it is executed by default value of True.


quality(optional) value: Low, High, Autolow, Autohig, or best. 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 (RGB value of 16 binary). Corresponding template variable: $BG The background color of the specified movie, which supersedes the setting of the background color in the Flash movie file, but does not affect the background color setting of the HTML page where the movie is located.


Scale (optional) value: ShowAll, Noborder, Exactfit. 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 several options:


Show All (default) displays the contents of the entire movie in the area of the specified size and retains the same aspect ratio as the original movie, and the movie content does not deform. "No Border" fills the specified area while maintaining the film's length-to-width ratio, and the movie content does not deform, but parts of the movie may not show up. Exact Fit makes the entire movie visible in the specified area because the original aspect ratio is not maintained at this time, so the movie is likely to deform. When this property is omitted (and the width and height values are expressed as percentages), the ShowAll is executed at the default value.


ALIGN values: L, R, T, B. Corresponding template variable: $HA. Function Description: Sets the "ALIGN" attribute in the "OBJECT", "EMBED", and "IMG" tabs to determine the position of the movie in the browser window. When omitted, the movie is placed in the center of the browser window, and if the browser window size is smaller than the area occupied by the movie, the browser window size will be resized to make the movie appear normally.


The "L" value aligns the movie to the left of the browser window, and if the browser window is not sufficient to accommodate the movie, the upper and lower sides of the window are adjusted. The "R" value aligns the movie to the right side of the browser window, and if the browser window is not sufficient to accommodate the movie, the upper and lower sides of the window are adjusted. The "T" value aligns the movie with the top edge of the browser window, and if the browser window is not sufficient to accommodate the movie, the left and right 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 sufficient to accommodate the movie, the left and right 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 a specified wide-height area. The meanings 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 position of the relative path used in the movie.


MENU(optional) evaluates to: True, false. The corresponding template variable: $ME. Function Description: Used to specify the type of shortcut menu that appears in the browser when you right-click the mouse (to Windows) or press and hold the command key (for Macintosh) in the movie's occupied area. A value of "True" displays the entire menu, allowing the presenter to control the screening process in a variety of ways. A value of "False" displays a menu containing only "about Flash" items. When this property is omitted, it is executed at the default value of "true".


WMODE(optional) value: Window, Opaque, Transparent. Corresponding template variable: $WM. Function Description: This parameter is only applicable in Windows systems with Flash Active x space.
The window value causes the movie to play in the location specified in the page, which is the fastest play in several options. The "Opaque windowless" value will block the content behind the movie on the page. The "Transparent" value causes the transparent part of the movie on the Web page to display the contents and background of the page, possibly slowing down the animation. When omitted, the property is executed in the default value of "window" and can only be used in the object tag.


First, Introduction:
We want to display the Flash content normally in the webpage, then must have the label of the specified flash path in the page. That is, the object and embed tags. The object tag is for the Windows platform of IE browser, and embed is used for Windows and Macintosh platform under the Netscape Navigator browser and the Macintosh platform under IE browser. The Windows platform's IE uses ActiveX controls to play Flash while other browsers use the Netscape plug-in technology to play flash.


Here is a sample code for inserting flash in a simple Web page:
Code:

<object classid= "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase= "http://download.macromedia.com/pub/ shockwave/cabs/flash/swflash.cab#version=6,0,40,0 "width=" 550 "height=" "id=" Mymoviename "><PARAM NAME= Movie value= "myflashmovie.swf" ><param name=quality value=high><param name=bgcolor VALUE= #FFFFFF >< EMBED src= "http://www.doflash.net/"/support/flash/ts/documents/myflashmovie.swf "Quality=high bgcolor= #FFFFFF Width= "550" height= "name=" Mymoviename "align=" "type=" Application/x-shockwave-flash "pluginspage="/HTTP/ Www.macromedia.com/go/getflashplayer "></EMBED></OBJECT>


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


The OBJECT tag is used for Windows IE3.0 and later browsers or other browsers that support ActiveX controls. The "ClassID" and "codebase" properties must be written exactly as shown in the example above, which tells the browser to automatically download the address of the Flash Player. If you have not installed Flash Player then the IE3.0 browser will jump out of a box to access whether or not 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 later browsers or other browsers that support Netscape plugins. The "pluginspage" property tells the browser to download the address of Flash Player, and if you do not have Flash Player installed, you will need to restart your browser to use it.


To make sure that most browsers display flash correctly, you need to nest the embed tag inside the OBJECT tag as shown in the code example above. Browsers that support ActiveX controls will ignore the embed tag within the OBJECT tag. Netscape and the IE browser using the plugin will read only the embed tag without recognizing the OBJECT tag. In other words, if you omit the embed tag, then Firefox will not recognize your flash (but it is puzzling that the omitted object only write Embed,ie can also display the flash, hehe, specific and then carefully see).


The following lists the necessary and optional properties for the object and embed tags used to publish the movie.


First, required attributes:


· CLASSID-Set the browser's ActiveX control for the OBJECT tag only.
· CODEBASE-Sets the location of the Flash ActiveX control so that if the browser is not installed, the installation can be downloaded automatically. Only for object tags.
· Width-Specifies the breadth of the flash movie in percent or pixels.
· Height-Specifies the altitude of the flash movie in percent or pixels.
· SRC-Specifies the movie's. For embed labels only.
· pluginspage-Set the location of the Flash plug-in, so if the browser is not installed, you can download the installation automatically. For embed labels only.
· Movie-Specifies the movie's. Only for object tags.


Second, optional attributes and available values:


·ID-Set the variable name for the reference to the script code. For object only.
·NAME-Set the variable name for a reference to the script code (such as JavaScript). For embed only.
·Swliveconnect-(TRUE or FALSE) Specifies whether Java is enabled when Flash Player downloads for the first time. If some attributes are omitted, the default value is False. You must use Fscommand to work with JavaScript and Flash,java on the same page.
·PLAY-(TRUE or FALSE) specifies whether the Flash movie will play automatically after the download is complete, or true if this attribute is omitted.
·LOOP-(TRUE or FALSE) specifies whether to stop or resume looping after the last frame of the movie is played, or true if this attribute is omitted.
· MENU -(True or false)
·TrueDisplays all menus, allowing users to zoom in, zoom out, and so on to control movie playback.
·FalseThe display contains only settings options and a menu about flash.
· Quality -(Low, High, Autolow, Autohigh, best)
· LowSpeed is superior to aesthetics and anti-aliasing is not applied.
·AutolowIt starts with a focus on speed, but improves aesthetics whenever needed.
·AutohighAt the same time focus on the playback speed and aesthetics, but the need to sacrifice beauty to ensure the playback speed.
·MediumApply some anti-aliasing without smoothing the bitmap. It is higher quality than the low setting and below the high setting.
· HighAesthetics is better than playback speed, and anti-aliasing is always applied. If the movie does not contain animations, the bitmap is smoothed, and if the movie contains animations, the bitmap will not be smoothed.
· BestProvides the best display quality without regard to playback speed. All outputs have anti-aliasing applied and all bitmaps are smoothed.
· Scale-(ShowAll, Noborder, Exactfit)
·DefaultThe show all movie is displayed within the specified area, but remains the original proportions. A border will appear on both sides of the movie.
·No BoderShrinks the movie to fit the specified area, keeping the movie not distorted, but some of the movie will probably be cropped. Keep the original proportions of the film however.
· Exact Fit Causes the entire movie to be displayed within the specified area, the movie may deform distorted, and does not maintain the original proportions.
· ALIGN -(L, T, R, B)
• The default is centered, and the edges are cropped when the browser window is smaller than the movie.
·Left,right,top,bottomAligns with the appropriate settings along the edge of the browser. If necessary, the other three sides will be cropped.
·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, specifying the transparency, stacking, and placement of flash in the browser.
· Window The movie plays within its own rectangular window in the browser.
·OpaqueThe movie hides all the content behind it.
·TransparentMake the Flash movie transparent, showing the contents of the page 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-Set the base directory or URL to resolve the relative path in Flash. Similar to <base> tags in web pages.
·FlashvarsPassing variables to Flash Player requires Flash PLAYER6 and later versions.
• Pass the root level variable to the movie. The format of the string is the Name=value set separated by "&".
• The browser supports 64kB size string lengths.
• For more information about Flashvars, please see the documentation.

The object tag in HTML is detailed

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.