Thursday, December 27, 2007

javascript for disabling links


<style>


a.disabled {cursor: default;color: #ccc;text-decoration: none;}


</style>


<script type="text/javascript">


var linkids=["href800 Series1","href1000 Series4","href1200 Series8"]


function activLink(b){


for (var i=0; i<linkids.length; i++){


                document.getElementById(linkids[i]).onclick=function(){return b}


                document.getElementById(linkids[i]).disabled=!b


                }


}


window.onload = function() {


activLink(false);


}


function activLink(b){


for (var i=0; i<linkids.length; i++){


                var thisLink = document.getElementById(linkids[i]);


                thisLink.onclick = function() { return b }


                thisLink.className = (b == true) ? '' : 'disabled';


                }


}


</script>


 


This javascript will disable links with the ids in the list


Your comments Here! Hover Your cursor to leave a comment.