Jump to content

Hi need some help with html and Javascript!?


Recommended Posts

Hello i have written some code and its works perfectly on google chrome, but i want to make it work on safari, opera, firefox, explorer. So what exactly this code does well it is powered by jquery and html. When you press key ,,a'' on a keyboard music start playing., but as i sed its only works on chrome, plis help me modify it so it would work on ff,opera,...

Here the code:

$(document).ready(function()

{

$(document).keyup(function(objEvent){

(objEvent) ? keycode=objEvent.keyCode : keycode = event.keyCode;

if(keycode==65)

{

var audio = document.getElementById("hello");

audio.play();

}

else if(keycode==66)

{

var audio = document.getElementById("hello2");

audio.play();

}

});

});

Plis help me!

red lumps appear

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...