"chris hughes" <chris(remove)_h******@hotmail.com> writes:
Can anyone please tell me how to create a javascript that I can place in any
page that will disable all the links or just change all the hrefs to #
disable links by removing the a-element:
---
function disableLinks () {
for (var i=0;i < document.links.length;i++) {
var link = document.links[i];
for (var j=0;j<link.childNodes.length;j++) {
link.parentNode.insertBefore(link.firstChild,link) ;
}
link.parentNode.removeChild(link);
}
}
document.body.onload=disableLinks;
---
Disable links by adding javascript clickhandler:
---
function retFalse () {
return false;
}
function disableLinks () {
for (var i=0;i < document.links.length;i++) {
document.links[i].onclick = retFalse;
}
}
document.body.onload=disableLinks;
---
(the disabling only works with javascript on, but so does this
script to begin with)
Change all hrefs to "" (shorter than "#"):
---
function disableLinks () {
for (var i=0;i < document.links.length;i++) {
document.links[i].href = "";
}
}
document.body.onload=disableLinks;
---
Good luck with whatever you are up to.
/L
--
Lasse Reichstein Nielsen -
lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'