在html中嵌入多媒体文件

时间:2022-01-23 03:19:57

1、嵌入pdf:

(1)利用object

<object classid="clsid:CA8A9780-280D-11CF-A24D-444553540000" width="1000" height="1200" border="0">  
<param name="_Version" value="65539">
<param name="_ExtentX" value="20108">
<param name="_ExtentY" value="10866">
<param name="_StockProps" value="0">
<param name="SRC" value="pdf/test.pdf">
<object data="pdf/test.pdf" type="application/pdf" width="1000" height="1200">
</object>
</object>

(2)使用超链接

<a href="javascript:" onclick="window.open('pdf/test.pdf')">内嵌pdf测试</a> 

2、嵌入word

<object classid=000209FF-0000-0000-C000-000000000046 height=200 width=100%>   
<param name=Src " VALUE= "msword/新建 Microsoft Word 文档.doc">
<param name=DisplayTitleBar value=false>
<param name=DataType value=HTMLData>
<param name=HTMLData value= " ">
<param name="SRC" value="msword/新建 Microsoft Word 文档.doc">
<object data="msword/新建 Microsoft Word 文档.doc" type="application/msword" width="1000" height="1200">
<a href="javascript:" onclick="window.open('msword/新建 Microsoft Word 文档.doc')">msword/新建 Microsoft Word 文档.doc</a>
</object>
</object>

3、嵌入音频

<bgsound src="music/爱笑的眼睛.mp3" loop="-1">  
<embed src="music/爱笑的眼睛.mp3" autostart="true" loop="true"></embed>  

4、嵌入视频chrome等浏览器支持html5,html5中video对象支持ogg、mp4(必须是H.264)格式的视频播放。为了兼容ie和chrome,采用了如下方法:

[html] view plaincopy
<video height="250" width="350" controls>
<source src="video/movie.mp4" type="video/mp4"/>
<embed SRC="video/movie.avi" type=audio/x-pn-realaudio-plugin autostart=false loop=false width=350 height=250></embed>
</video>

5、嵌入flash

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="1000" height="200">  
<param name="movie" value="flash/test.swf" />
<param name="quality" value="high" />
<param name="wmode" value="transparent" />
<embed src="flash/test.swf" width="1000" height="200" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" ></embed>
</object>