<object> 元素可支持多种不同的媒介类型,比如:
- 图片
- 音频
- 视频
- Other 对象
显示图片
你可以显示一幅图片:
<object height="100%" width="100%" type="image/jpeg" data="audi.jpeg"> </object>显示网页
您可以显示一张网页:
<object type="text/html" height="100%" width="100%" data="http://www.w3school.com.cn"> </object>播放音频
您可以播放音频:
<object classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95"> <param name="FileName" value="liar.wav" /> </object>播放视频
你可以播放视频:
<object classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95"> <param name="FileName" value="3d.wmv" /> </object>显示日历
您可以显示日历:
<object width="100%" height="80%" classid="clsid:8E27C92B-1264-101C-8A2F-040224009C02"> <param name="BackColor" value="14544622"> <param name="DayLength" value="1"> </object>显示图形:
你可以显示图形:
<object width="200" height="200" classid="CLSID:369303C2-D7AC-11D0-89D5-00A0C90833E6"> <param name="Line0001" value="setFillColor(255, 0, 255)"> <param name="Line0002" value="Oval(-100, -50, 200, 100, 30)"> </object>显示 Flash
您还可以显示 flash 动画:
<object width="400" height="40" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com /pub/shockwave/cabs/flash/swflash.cab#4,0,0,0"> <param name="SRC" value="bookmark.swf"> <embed src="bookmark.swf" width="400" height="40"></embed> </object>为什么 class ID 会改变?
Windows Media Player 7 及更高版本的 class ID 是:clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6.
因特网上的许多地方把 class ID 声明为:clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95. 此 class ID 是一个老的版本,但是依然可以工作,这是因为其向后兼容性。但是如果您使用了老的 class ID,就无法使用增加到组件中的新特性了。
Windows Media Player 10
clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6 (与 WMP7 相同)
Windows Media Player 9
clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6 (与 WMP7 相同)
Windows Media Player 7
clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6
Windows Media Player 6.4
clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95
| 参数 | 默认值 | 描述 |
|---|---|---|
| AudioStream | true | |
| AutoSize | true | |
| AutoStart | true | Sets if the player should start automatically |
| AnimationAtStart | true | Sets if an animation should show while the file loads |
| AllowScan | true | |
| AllowChangeDisplaySize | true | |
| AutoRewind | false | |
| Balance | false | |
| BaseURL | | |
| BufferingTime | 5 | |
| CaptioningID | | |
| ClickToPlay | true | Sets if the player should start when the user clicks in the play area |
| CursorType | false | |
| CurrentPosition | true | |
| CurrentMarker | false | |
| DefaultFrame | | |
| DisplayBackColor | false | |
| DisplayForeColor | 16777215 | |
| DisplayMode | false | |
| DisplaySize | false | |
| Enabled | true | |
| EnableContextMenu | true | |
| EnablePositionControls | true | |
| EnableFullScreenControls | false | |
| EnableTracker | true | |
| Filename | URL | The URL of the file to play |
| InvokeURLs | true | |
| Language | true | |
| Mute | false | |
| PlayCount | 1 | |
| PreviewMode | false | |
| Rate | 1 | |
| SAMILang | | |
| SAMIStyle | | |
| SAMIFileName | | |
| SelectionStart | true | |
| SelectionEnd | true | |
| SendOpenStateChangeEvent | true | |
| SendWarningEvents | true | |
| SendErrorEvents | true | |
| SendKeyboardEvents | false | |
| SendMouseClickEvents | false | |
| SendMouseMoveEvents | false | |
| SendPlayStateChangeEvent | true | |
| ShowCaptioning | false | |
| ShowControls | true | Sets if the player controls should show |
| ShowAudioControls | true | Sets if the audio controls should show |
| ShowDisplay | false | Sets if the display should show |
| ShowGotoBar | false | Sets if the GotoBar should show |
| ShowPositionControls | true | |
| ShowStatusBar | false | |
| ShowTracker | true | |
| TransparantAtStart | false | |
| VideoBorderWidth | false | |
| VideoBorderColor | false | |
| VideoBorder3D | false | |
| Volume | -200 | |
| WindowlessVideo | false | |