web-7. 丰富页面的多媒体

7. 丰富页面的多媒体

7.1 声音

浏览器可以播放的音频格式有:MIDIWAVMP3等,其中MP3格式的文件目前应用最为广泛。

  1. 背景声音

<head>

......

<bgsound src=”” loop=””>

......

</head>

<bgsound>标记的src属性用于设置声音文件的名称和路径;loop属性用于设置反复播放的次数,属性值为“Infinite”时表示在浏览者离开该页面前将持续播放背景音乐;autostart属性用于设置是否自动播放,属性值为“true”时表示是,属性值为“false”时表示否,默认属性为“true”。

经读者操作上述发方法不能播放声音。

于是采用下面的语句:

<embed src="./music.mp3" loop="1" hidden="true"> hidden将按钮隐藏。

  1. 连接声音

<a href=”” >***</a>

  1. 嵌入声音

<embed src="" loop="" hidden="" width=”” heigth=””>

例如:

<html>

<head>

<title>music</title>

</head>

<body bgcolor="#dddddd">

<embed src="./music.mp3" loop="1" hidden="true">

音乐--tik tok

</body>

</html>

7.2 嵌入视频

  1. 连接视频

编程人员使用<a>标记在HTML页面中连接视频文件。

<a href=””>**</a>

  1. 嵌入视频

<embed src="" hidden="" width=”” heigth=”” loop="">

编程人员使用<embed>标识将视频嵌入到HTML页面时也会显示一个多媒体平台,控制平台上有播放、暂停、停止等控制按钮。

例子:

<html>

<head>

<title>music</title>

</head>

<body bgcolor="#dddddd">

<embed src="./happy.mp4">

音乐--tik tok

</body>

</html>

7.3 嵌入flash

<embed src="**.swf" hidden="" width=”” heigth=””>

7.4 滚动的文字

<marquee direction=””behavior”” scrollamount=”” loop=””>

......

</marquee>

<marquee>标识的direction属性用来设置滚动的方向,取值可以是up(向上)、down(向下)、left(向左)、right(向右)。

behav属性用来设置滚动的方式,取值可以是scroll(循环滚动)、slide(指滚动一次)与alternate(来回滚动)。scrollamoun属性用来设置滚动的速度;loop用来设置滚动的次数。

例子:

<html>

<head>

<title>music</title>

</head>

<body bgcolor="#dddddd">

<marquee direction="left" scrollamount="10">

段立勇真厉害!

</marquee>

</body>

</html>

原文地址:https://www.cnblogs.com/free-1122/p/9860856.html