ott
04-26-2006, 03:32 AM
Heres some code to add your events even if there was one+ already.
// function add*Event(e, func)
// www.ottbot.com Richard Maloney
// e - element
// func - function
//
function addClickEvent(e,func) {
if (typeof e.onclick !== 'function') { e.onclick = func; }
else { e.oldclick = e.onclick; e.onclick = function() { this.oldclick(); func();}}}
function addOverEvent(e,func) {
if (typeof e.onmouseover !== 'function') { e.onmouseover = func; }
else { e.oldover = e.onmouseover; e.onmouseover = function() { this.oldover(); func();}}}
function addOutEvent(e,func) {
if (typeof e.onmouseout !== 'function') { e.onmouseout = func; }
else { e.oldout = e.onmouseout; e.onmouseout = function() { this.oldout(); func();}}}
// function add*Event(e, func)
// www.ottbot.com Richard Maloney
// e - element
// func - function
//
function addClickEvent(e,func) {
if (typeof e.onclick !== 'function') { e.onclick = func; }
else { e.oldclick = e.onclick; e.onclick = function() { this.oldclick(); func();}}}
function addOverEvent(e,func) {
if (typeof e.onmouseover !== 'function') { e.onmouseover = func; }
else { e.oldover = e.onmouseover; e.onmouseover = function() { this.oldover(); func();}}}
function addOutEvent(e,func) {
if (typeof e.onmouseout !== 'function') { e.onmouseout = func; }
else { e.oldout = e.onmouseout; e.onmouseout = function() { this.oldout(); func();}}}