You should move the onClick property from the <a> tags to the <td> tags. That way it will work no matter where you click on the button. Right now you
have to click the text or it won't work.
And here is my attempt at JavaScript to make the phone dialable. You just replace the onClick calls to playSound with calls to this, like buttonPress('1') or buttonPress('star'). The numbers array sets what JavaScript to run for what number.
function buttonPress(button) {
var numbers = [
["123", "alert('pla');"],
["321", "window.location = 'http://www.google.com/';"],
["s69", "playSound('http://www.phonelosers.com/media/tps/thephoneshow.2011-05-31.mp3')"],
]
playSound("http://www.phonelosers.org/media/touchtones/dtmf-"+button+".mp3");
var maxDigits = 0;
for (var i = 0; i < numbers.length; i++)
if (maxDigits < numbers[i][0].length) maxDigits = numbers[i][0].length;
button = button.substring(0,1);
buttons = readCookie("payphone_dialed");
if (buttons == null) buttons = "";
buttons += button;
if (buttons.length > maxDigits) buttons = buttons.substr(buttons.length - maxDigits);
createCookie("payphone_dialed", buttons, 1);
buttons = buttons.toUpperCase();
for (var i = 0; i < numbers.length; i++)
if (buttons.indexOf(numbers[i][0].toUpperCase()) >= 0) {
eraseCookie("payphone_dialed");
setTimeout(numbers[i][1], 2600);
}
}
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
function eraseCookie(name) {
createCookie(name,"",-1);
}