I have been working recently on an ecommerce site which uses a legacy evernt handler script at the checkout stage.
I have it working fine in IE but it does nothing in Firefox - think it was written in Netscape days, hopefully its something simple.
This is the event handler .js file, which is called from the payment.php file - im hoping a simple change can be made to this js file - can anyone help:
var isNav = (navigator.appName.indexOf("Netscape") !=-1);
var isIE = (navigator.appName.indexOf("Microsoft") !=-1);
function addhandlers(o)
{
o.onabort = handler;
o.onblur = handler;
o.onchange = handler;
o.onclick = handler;
o.ondblclick = handler;
o.onerror = handler;
o.onfocus = handler;
o.onkeydown = handler;
o.onkeypress = handler;
o.onkeyup = handler;
o.onmousedown = handler;
o.onmouseout = handler;
o.onmouseover = handler;
o.onmouseup = handler;
o.onmove = handler;
o.onreset = handler;
o.onresize = handler;
o.onselect = handler;
o.onsubmit = handler;
o.onunload = handler;
//FIRST, TELL THE BROWSERS TO REACT TO THE EVENT
if( document.captureEvents )
{
//non IE
if( Event.KEYPRESS )
{
//NS 4, NS 6+, Mozilla 0.9+
document.captureEvents( Event.KEYPRESS );
}
}
}
addhandlers(window);
addhandlers(document);
for (var d = 0; d < document.links.length; d++)
addhandlers(document.links[d]);
for (var d = 0; d < document.images.length; d++)
addhandlers(document.images[d]);
for (var d = 0; d < document.forms.length; d++)
{
addhandlers(document.forms[d]);
for (var e = 0; e < document.forms[d].elements.length; e++)
addhandlers(document.forms[d].elements[e]);
}
I have it working fine in IE but it does nothing in Firefox - think it was written in Netscape days, hopefully its something simple.
This is the event handler .js file, which is called from the payment.php file - im hoping a simple change can be made to this js file - can anyone help:
var isNav = (navigator.appName.indexOf("Netscape") !=-1);
var isIE = (navigator.appName.indexOf("Microsoft") !=-1);
function addhandlers(o)
{
o.onabort = handler;
o.onblur = handler;
o.onchange = handler;
o.onclick = handler;
o.ondblclick = handler;
o.onerror = handler;
o.onfocus = handler;
o.onkeydown = handler;
o.onkeypress = handler;
o.onkeyup = handler;
o.onmousedown = handler;
o.onmouseout = handler;
o.onmouseover = handler;
o.onmouseup = handler;
o.onmove = handler;
o.onreset = handler;
o.onresize = handler;
o.onselect = handler;
o.onsubmit = handler;
o.onunload = handler;
//FIRST, TELL THE BROWSERS TO REACT TO THE EVENT
if( document.captureEvents )
{
//non IE
if( Event.KEYPRESS )
{
//NS 4, NS 6+, Mozilla 0.9+
document.captureEvents( Event.KEYPRESS );
}
}
}
addhandlers(window);
addhandlers(document);
for (var d = 0; d < document.links.length; d++)
addhandlers(document.links[d]);
for (var d = 0; d < document.images.length; d++)
addhandlers(document.images[d]);
for (var d = 0; d < document.forms.length; d++)
{
addhandlers(document.forms[d]);
for (var e = 0; e < document.forms[d].elements.length; e++)
addhandlers(document.forms[d].elements[e]);
}