您的位置:首页 > Web前端 > HTML

HTML初步学习10

2015-10-03 10:30 666 查看
今天学习多媒体的编写

首先是飘动文字,主要由以下属性:飘动方向、速度、范围、次数、方式、留白区(vspace hspace)

1 if(navigator.userAgent.indexOf("Chrome") > -1){
2
3 如果是Chrome:
4
5 <audio src="" type="audio/mp3" autoplay=”autoplay” hidden="true"></audio>
6
7 }else if(navigator.userAgent.indexOf("Firefox")!=-1){
8
9 如果是Firefox:
10
11 <embed src="" type="audio/mp3" hidden="true" loop="false" mastersound></embed>
12
13 }else if(navigator.appName.indexOf("Microsoft Internet Explorer")!=-1 && document.all){
14
15 如果是IE(6,7,8):
16
17 <object classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95"><param name="AutoStart" value="1" /><param name="Src" value="" /></object>
18
19 }else if(navigator.appName.indexOf("Opera")!=-1){
20
21 如果是Oprea:
22
23 <embed src="" type="audio/mpeg" loop="false"></embed>
24
25 }else{
26
27 <embed src="" type="audio/mp3" hidden="true" loop="false" mastersound></embed>
28
29 }
30
31 或
32
33 代码如下:
34
35 var ua = navigator.userAgent.toLowerCase();
36
37 if(ua.match(/msie ([\d.]+)/)){
38
39 jQuery('#__alert_sound').html('<object classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95"><param name="AutoStart" value="1" /><param name="Src" value="/sounds/alert/1.mp3" /></object>');
40
41 }
42
43 else if(ua.match(/firefox\/([\d.]+)/)){
44
45 jQuery('#__alert_sound').html('<embed src="/sounds/alert/1.mp3" type="audio/mp3" hidden="true" loop="false" mastersound></embed>');
46
47 }
48
49 else if(ua.match(/chrome\/([\d.]+)/)){
50
51 jQuery('#__alert_sound').html('<audio src="/sounds/alert/1.mp3" type="audio/mp3" autoplay=”autoplay” hidden="true"></audio>');
52
53 }
54
55 else if(ua.match(/opera.([\d.]+)/)){
56
57 jQuery('#__alert_sound').html('<embed src="/sounds/alert/1.mp3" hidden="true" loop="false"><noembed><bgsounds src="/sounds/alert/1.mp3"></noembed>');
58
59 }
60
61 else if(ua.match(/version\/([\d.]+).*safari/)){
62
63 jQuery('#__alert_sound').html('<audio src="/sounds/alert/1.mp3" type="audio/mp3" autoplay=”autoplay” hidden="true"></audio>');
64
65 }
66
67 else {
68
69 jQuery('#__alert_sound').html('<embed src="/sounds/alert/1.mp3" type="audio/mp3" hidden="true" loop="false" mastersound></embed>');
70
71 }
72
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: