I really haven't looked into the particulars of this specific request, even though I received a PM about it, perhaps I will get to that later. In any case, here is a demo that will work out well in most modern browsers (it includes code to setup the events as well as to disable/enable them - the disabling/enabling code is in red):
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
.always {
z-index:10;
position:relative;
}
</style>
<script type="text/javascript">
function testAdd(){
alert('test added');
}
window.onload=function(){
for (var l=document.getElementsByTagName('a'), i = 0; i < l.length; i++)
if (l[i].href&&i==0)
if ( typeof window.addEventListener != "undefined" )
l[i].addEventListener( "click", testAdd, false );
else if ( typeof window.attachEvent != "undefined" )
l[i].attachEvent( "onclick", testAdd );
else {
if ( l[i].onclick != null ) {
var oldOnclick = l[i].onclick;
l[i].onclick = function ( e ) {
oldOnclick( e );
testAdd();
};
}
else
l[i].onclick = testAdd;
}
}
var doLinks={kill:function(){return;},live:function(){return;}};
if(document.createElement)
doLinks={
el:document.createElement('div'),
kill:function(){
var k=this.el.style;
if(k.position!='absolute'){
k.position='absolute';
k.top=k.left=0;
k.zIndex=9;
k.backgroundColor='gray';
if(typeof k.opacity=='string')
k.opacity='0.01';
else if(typeof k.MozOpacity=='string')
k.MozOpacity='0.01';
else if(typeof k.KhtmlOpacity=='string')
k.KhtmlOpacity='0.01';
else if (document.documentElement.filters){
k.filter='alpha(opacity=1)';
k.backgroundColor='transparent';
}
else
k.backgroundColor='transparent';
k.height=Math.max(document.body.offsetHeight, document.documentElement.offsetHeight)+'px';
k.width=Math.max(document.body.offsetWidth, document.documentElement.offsetWidth)+'px';
}
document.body.appendChild(this.el);
if (document.documentElement.filters&&k.backgroundColor!='gray')
k.backgroundColor='gray';
},
live:function(){document.body.removeChild(this.el);}
};
</script>
</head>
<body>
<input type="button" onclick="doLinks.kill();" value="Kill Links"><br>
<input class="always" type="button" onclick="doLinks.live();" value="Revive Links"><br>
<a href="http://www.google.com/" onclick="alert(this.href);return false;">Test Link with hard coded & 'added/attached' click events</a><br>
<a href="http://www.dynamicdrive.com/">Normal Link</a><br>
<a class="always" href="http://www.dynamicdrive.com/forums/">Always a Link</a>
</body>
</html>
It could fairly easily be adapted to service an element rather than the entire page, as it is currently written to do. But since you can use the always class to exempt any content from the overlay, this hardly seems necessary.
Bookmarks