Use JavaScript to make sound button articles introduction:

Source: Internet
Author: User
Tags button type
javascript| button

Article Introduction:

In general, a button on a Web page does not have a sound triggering event. If you want the button to sound in response to the mouse action, we can write a section of JavaScript script code to implement it.

Can let the button to make a sound script, this does not have to make flash button also can, I try to feel good.

Production method:

1. New file:

Dynamicaudiobutton.js, Code:
Customize Dynamic Audio Link custom dynamically sound links
function Dynamicaudiolink () {
Open ("http://www.pcedu.com.cn")
}

Customize dynamic Audio Mouse over color custom animated sound mouseover color
function Audioover () {
Document. Audio.button.style.background= "#999999"
Document. Audio.button.style.color= "White"
}

Customize dynamic Audio Mouse down color custom animated sound MouseDown color
function Audiodown () {
Document. Audio.button.style.color= "#cccccc"
}

Customize dynamic Audio Mouse off color custom animated sound Mouseoff color
function Audioout () {
Document. Audio.button.style.background= "#666666"
Document. Audio.button.style.color= "#ffffff"
}

Customize Dynamic Audio Sound Custom animated sound
function Playhome ()
{
DOCUMENT.ALL.SOUND.SRC = "Bleep.wav";
}

document.write (' ' + ' ' + ' ')

document.write ('

")
2. After you save the file, insert code to refer to the JS file in the page related department:


3, choose good music files, can be WAV, MP3, music files as small as possible.

Method is finished, the user can use the form of picture and so on, the corresponding code of the Dynamicaudiobutton.js file must also be modified.



Related Article

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.