Changing Image - Click Sound
Saturday, January 10th, 2009Put this part in the <head></head> tag.
You can change the IMAGE FILE OFF, IMAGE FILE ON, and YOUR LINK LOCATION
<script language=”JavaScript”>
// Created by Parmjit (parmjit.sandhu@mailcity.com)
if ((navigator.appVersion.indexOf(”3.”) != -1) && (navigator.appName.indexOf(”Explorer”) != -1)){
check = false;}
else {
check = true;}
if (navigator.appName.indexOf(”Explorer”) != -1){
noplay = false;}
else {
noplay = true;}
image1= new Image();
image1.src = “IMAGE FILE OFF”;
image1on = new Image();
image1on.src = “IMAGE FILE ON”;
function imageon(name) {
document[name].src = eval(name + “on.src”);
}
function imageoff(name) {
document[name].src = eval(name + “.src”);
}
function on(name) {
if (check == true){
imageon(name);
}
}
function off(name) {
if (check == true){
imageoff(name);
}
}
function startTime(){
document.sound.play();
var time= new Date();
hours= time.getHours();
mins= time.getMinutes();
secs= time.getSeconds();
closeTime=hours*3600+mins*60+secs;
closeTime+=1;
Timer();
}
function Timer(){
var time= new Date();
hours= time.getHours();
mins= time.getMinutes();
secs= time.getSeconds();
curTime=hours*3600+mins*60+secs
if (curTime>=closeTime){
location = “YOUR LINK LOCATION”}
else{
window.setTimeout(”Timer()”,1000)}
}
</script>
Now put this where ever you want you image to go.
<EMBED SRC=”YOUR SOUND FILE” autostart=false HIDDEN=TRUE NAME=”sound” MASTERSOUND>
<a href=”" onmouseover=”on(’image1′);” onmouseout=”off(’image1′)” onClick=”startTime(); return false;”><img src=”YOUR IMAGE OFF” border=”0″ name=”image1″></a>
