随日期播放网页背景音乐

  • 随日期播放网页的背景音乐,每一天都有自己的音乐,请注意,运行代码听不到音乐,是因为缺少本地音乐文件,你可以按照代码内预留的音乐路径,修改实际的音乐文件,最好是选择MID文件,这样的文件网页加载比较快。
<html>
<head>
<title>随日期播放音乐</title>
</head>

<body>
<table border=1 bordercolor=#FFFFFF borderlight=green cellspacing="0" width="220" bordercolorlight="#000000">
<tr><td align=center width="220"><strong>石家庄礼品公司</strong></td></tr>
<tr><td align=center width="220">
<SCRIPT language="JavaScript">
<!--
page=new Date();        //得到当前日期
if (page.getDate() == 1)     //如果“日期”为1,则播放一号曲目
document.write("<bgsound src=midi/001.mid width=145 height=30 autostart=true loop=-1 volume=50>");
if (page.getDate() == 2)     /*播放曲目的代码通过js写入页面*/
document.write("<bgsound src=midi/001.mid width=145 height=30 autostart=true loop=-1 volume=50>");
if (page.getDate() == 3)     /*曲目作为背景音乐存在*/
document.write("<bgsound src=midi/001.mid width=145 height=30 autostart=true loop=-1 volume=50>");
if (page.getDate() == 4)     /*以midi文件存放*/
document.write("<bgsound src=midi/002.mid width=145 height=30 autostart=true loop=-1 volume=50>");
if (page.getDate() == 5)
document.write("<bgsound src=midi/002.mid width=145 height=30 autostart=true loop=-1 volume=50>");
if (page.getDate() == 6)
document.write("<bgsound src=midi/002.mid width=145 height=30 autostart=true loop=-1 volume=50>");
if (page.getDate() == 7)
document.write("<bgsound src=midi/003.mid width=145 height=30 autostart=true loop=-1 volume=50>");
if (page.getDate() == 8)
document.write("<bgsound src=midi/003.mid width=145 height=30 autostart=true loop=-1 volume=50>");
if (page.getDate() == 9)
document.write("<bgsound src=midi/pinball.mid width=145 height=30 autostart=true loop=-1 volume=50>");
if (page.getDate() == 10)
document.write("<bgsound src=midi/pinball.mid width=145 height=30 autostart=true loop=-1 volume=-1>");
if (page.getDate() == 11)     /*为方便起见,这里就不用过多的midi文件了*/
document.write("<bgsound src=midi/001.mid width=145 height=30 autostart=true loop=-1 volume=50>");
if (page.getDate() == 12)     /*事实上,这些文件名可以任意指定*/
document.write("<bgsound src=midi/001.mid width=145 height=30 autostart=true loop=-1 volume=50>");
if (page.getDate() == 13)
document.write("<bgsound src=midi/001.mid width=145 height=30 autostart=true loop=-1 volume=50>");
if (page.getDate() == 14)
document.write("<bgsound src=midi/001.mid width=145 height=30 autostart=true loop=-1 volume=50>");
if (page.getDate() == 15)
document.write("<bgsound src=midi/001.mid width=145 height=30 autostart=true loop=-1 volume=50>");
if (page.getDate() == 16)
document.write("<bgsound src=midi/pinball.mid width=145 height=30 autostart=true loop=-1 volume=50>");
if (page.getDate() == 17)
document.write("<bgsound src=midi/pinball.mid width=145 height=30 autostart=true loop=-1 volume=50>");
if (page.getDate() == 18)
document.write("<bgsound src=midi/pinball.mid width=145 height=30 autostart=true loop=-1 volume=50>");
if (page.getDate() == 19)
document.write("<bgsound src=midi/pinball.mid width=145 height=30 autostart=true loop=-1 volume=50>");
if (page.getDate() == 20)
document.write("<bgsound src=midi/pinball.mid width=145 height=30 autostart=true loop=-1 volume=50>");
if (page.getDate() == 21)
document.write("<bgsound src=midi/003.mid width=145 height=30 autostart=true loop=-1 volume=50>");
if (page.getDate() == 22)
document.write("<bgsound src=midi/003.mid width=145 height=30 autostart=true loop=-1 volume=50>");
if (page.getDate() == 23)
document.write("<bgsound src=midi/003.mid width=145 height=30 autostart=true loop=-1 volume=50>");
if (page.getDate() == 24)
document.write("<bgsound src=midi/003.mid width=145 height=30 autostart=true loop=-1 volume=50>");
if (page.getDate() == 25)
document.write("<bgsound src=midi/002.mid width=145 height=30 autostart=true loop=-1 volume=50>");
if (page.getDate() == 26)
document.write("<bgsound src=midi/002.mid width=145 height=30 autostart=true loop=-1 volume=50>");
if (page.getDate() == 27)
document.write("<bgsound src=midi/002.mid width=145 height=30 autostart=true loop=-1 volume=50>");
if (page.getDate() == 28)
document.write("<bgsound src=midi/001.mid width=145 height=30 autostart=true loop=-1 volume=50>");
if (page.getDate() == 29)
document.write("<bgsound src=midi/001.mid width=145 height=30 autostart=true loop=-1 volume=50>");
if (page.getDate() == 30)
document.write("<bgsound src=midi/001.mid width=145 height=30 autostart=true loop=-1 volume=50>");
if (page.getDate() == 31)
document.write("<bgsound src=midi/pinball.mid width=145 height=30 autostart=true loop=-1 volume=50>");

page=new Date();        //取当前时间
var months = new Array(13);    //建立月份描述的数组
months[1] = "1月";
months[2] = "2月";
months[3] = "3月";
months[4] = "4月";
months[5] = "5月";
months[6] = "6月";
months[7] = "7月";
months[8] = "8月";
months[9] = "9月";
months[10] = "10月";
months[11] = "11月";
months[12] = "12月";
var dateObj = new Date()    //取当前时间
var lmonth = months[dateObj.getMonth() + 1]    //得到月份值(如要符合习惯的月份值,则还需加一,因为js里的月份是从0开始计算的)
var date = dateObj.getDate() //取当前星期描述
document.write("<br>" +"hi,你好!" +"<br>今天是"+ lmonth + date+"日,<br>"+"让我们来听听今天的音乐")    //写问候语
//-->

</SCRIPT>
</td>
</tr>
</table>
</body>
</html>

随日期播放网页背景音乐

时间: 2024-08-09 06:37:21

随日期播放网页背景音乐的相关文章

CenOS下firefox browser (火狐浏览器)无法播放网页音乐的解决方法

新装载的Firefox或许无法播放网页音频,解决方法如下: 1. 下载并安装 flashplayer插件&&下载网址:https://get.adobe.com/flashplayer/?loc=cn 2. 解压 并将其中的libflashplayer.so放到主文件夹及/Home下 3. 进入terminal获取管理员权限操作,使用  su 命令 4. 查看主文件夹下是否存在 libflashplayer.so文件,dir命令 5. 复制libflashplayer.so到火狐插件文件夹

网页背景音乐小结

1.设置网页背景音乐时常用的方法是使用 embed标签 .object标签和bgsound标签(<bgsound id="snd"; loop="2"; src=""; volume="0";/>) 2.WEB应用程序和WINFORM应用程序可以用Timer定时器,而WEB网站项目没有Timer,只能用window.setTimeOut()作为定时器循环调用特定函数window.setTimeout("C

iPhone、iPad 如何播放网页调用优酷视频?

iPhone.iPad 如何播放网页调用优酷视频? 5 条评论 分享 按投票排序按时间排序 6 个回答 赞同4反对,不会显示你的姓名 寒塘渡月,借我一生 与梦私奔 http://sometime.me 陶铖.知乎用户.范红振 等人赞同 在线视频一般都是基于flash和flv来实现的,而众所周知,iOS的safari不支持网页中的flash,但支持html5的video标记(显然这个时代苹果必须以某种方式支持网络视频),对于video标记,会在其区域上显示播放按钮,点按后进入全屏播放. 所以优酷等

HTML5添加网页背景音乐

记录几个给网站添加背景音乐的HTML5代码,稍微总结一下 方式一:<video controls="" autoplay="" name="media"><source src="音乐" type="audio/mpeg"></video> 这种方式会显示播放器. 方式二:<embed src="music/We Don't Talk Anymore.mp

【转】Ubuntu FireFox无法播放网页视频音乐的解决办法

原文:http://www.codeweblog.com/%E8%A7%A3%E5%86%B3qq%E9%9F%B3%E4%B9%90%E7%BD%91%E9%A1%B5%E7%89%88%E5%9C%A8ubuntu-firefox%E4%B8%8B%E6%97%A0%E6%B3%95%E6%92%AD%E6%94%BE%E7%9A%84%E9%97%AE%E9%A2%98/ 一条命令可以安装大多数音视频解码器: sudo apt-get install ubuntu-restricted-e

HTML5 标签audio添加网页背景音乐代码

<head> <meta http-equiv="Content-Type" name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0,user-scalable=no"> <meta charset="utf-8"> <meta name=&

十二篇、HTML5隐藏播放器播放背景音乐

html5添加网页背景音乐 一个客户要求给网站添加一个背景音乐,我用的是html5添加网页背景音乐的代码,在此记录一下以后有用. html5方法一:<audio autoplay="" loop=""><source src="http://mi.0w0.im/Letter_Song.mp3 "></audio>不显示播放器. html5方法二:<video controls="" a

有两种分别用&lt;bgsound&gt;和&lt;embed&gt;&lt;/embed&gt;标签,当用&lt;embed&gt;插入背景音乐时可以设置宽度和高度为0,隐藏播放器。

<bgsound>: <bgsound> 是用来插入背景音乐,但只适用于 ie,其参数设定不多.如下 <bgsound src="your.mid" autostart=true loop=infinite> src="your.mid"设定 midi 档案及路径,可以是相对或绝对.autostart=true是否在音乐档下载完之后就自动播放.true 是,false 否 (内定值).loop=infinite是否自动反复播放.l

在网页中添加背景音乐

有两种添加背景音乐的方式分别用<bgsound>和<embed></embed>标签,当用<embed>插入背景音乐时可以设置宽度和高度为0,隐藏播放器.二者的参数如下: ■ <bgsound>: <bgsound> 是用来插入背景音乐,但只适用于 IE,其参数设定不多.如下 <bgsound src="your.mid"autostart=true loop=infinite> src="y