inicio mail me! sindicaci;ón

Use Javascript makes sound button

Article brief introduction:

Generally speaking, the pushbutton in the webpage is to do not have sound to spark of incident. If want to let pushbutton answer mouse movement to sound, we can write code of script of a paragraph of Javascript to come true.

Can let the script that pushbutton sounds, this it is OK also to need not make Flash button, the sense of my try out is good still.

The method that make:

1, build a file:

It is to cite below extract:
DynamicAudioButton.js, code:
/ / Customize Dynamic Audio Link defines dynamic sound link oneselfFunction DynamicAudioLink(){Open(”http://www.pcedu.com.cn” )
}

/ / Customize Dynamic Audio Mouse Over Color defines color of dynamic sound Mouseover oneselfFunction AudioOver() {Document.Audio.button.style.background= “#999999 “Document.Audio.button.style.color= “white “
}

/ / Customize Dynamic Audio Mouse Down Color defines color of dynamic sound Mousedown oneselfFunction AudioDown() {Document.Audio.button.style.color= “#cccccc “
}

/ / Customize Dynamic Audio Mouse Off Color defines color of dynamic sound MouseOff oneselfFunction AudioOut() {Document.Audio.button.style.background= “#666666 “Document.Audio.button.style.color= “#ffffff “
}

/ / Customize Dynamic Audio Sound defines dynamic sound oneselfFunction PlayHome()
{Document.all.sound.src = “bleep.wav” ;
}

Document.write(’<bgsound Id= "sound" >’ )

/ / Customize Button Style defines pushbutton style oneselfDocument.write(’<style Type= "text/CSS" >’ ‘< ! - - ‘ )Document.write(’.select{background:#666666;border-color: “#999999″ ;color: “#ffffff” ;font-family:ARial, helvetica, verdana;font-size:10pt;font-weight: Bold;}’ ‘- - > ‘ ‘</STYLE>’ )

Document.write(’<center><form Name=Audio><input Class= "select" Name=button Type= "button" Value= "Dynamic Audio" Onclick= "DynamicAudioLink()" OnMouseOver= "AudioOver();playHome()" OnMouseDown= "AudioDown()" OnMouseOut= "AudioOut()" ></form></center>’ )

2, after saving a file, in the page relevant point inserts code to cite this JS file:

It is to cite below extract:
<Script Language= "JavaScript" SRC= "DynamicAudioButton.js" ></script>

3, choose good music file, can be Wav, MP3, musical file as far as possible somes small.

The method is made finish, the user can use the form such as the picture, also get the code with modification DynamicAudioButton.js corresponding file of course.

Bookmark:Digg Del.icio.us Reddit

Leave a Comment