JS to add background music to the Web page and select the sound effects of the method _javascript skills

Source: Internet
Author: User

This article describes the JS to the Web page plus background music and choose the sound effects method. Share to everyone for your reference. The implementation methods are as follows:

Copy Code code as follows:
<HTML>
<HEAD>
<TITLE> Add background music to the Web page, select Sound function </TITLE>
<STYLE>
<!--style sheet-->
A{font-size:30pt;color:blue;font-family:vineta BT}
A:link{text-decoration:none;}
A:hover{text-decoration:none;color:red}
A:visited{text-decoration:none;}
.20pt{font-size:20pt;color: #ff66cc}
</STYLE>
<script language=javascript>
var mid=new Array ()
mid[1]= "Sound/201101/s01.wav"
mid[2]= "Sound/201101/s02.wav"
function Clicksound (i)
{
Document.all.sound.src=mid[i]
}
</script>
</HEAD>
<BODY>
<bgsound id=sound src= "" loop=1>
<bgsound src= "Sound/201101/abuse.mid" >
<center>
<a href= "#" onclick= "Clicksound (1)" >no! No! No!</a><br>
<a href= "#" onclick= "Clicksound (2)" >you win! cheer!</a><br>
&LT;HR width=700>
<font class=20pt> mouse clicks on the above content, there will be a dynamic background sound </font>
</center>
</BODY>
</HTML>

I hope this article will help you with your JavaScript programming.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.