Hi,
I have a link defined as follows:
<a href="" id="clrest">Restrict</a>
Now, in my JS function, I'm disabling/enabling the link as follows:
document.links[2].disabled = true;
However, I need to change my JS statement from referencing "2" to referencing whatever position that link happens to be, so I modified my code to this:
function disableLink(){
var rnum = document.getElementById("clrest").value;
document.links[rnum].disabled = true;
}
But for rnum, I keep getting "undefined". What is my problem? I thought using the getElementByID and the value attribute would return the position of that particular link.
Am I doing something wrong?
Thanks in advance for your help.
soho34
I have a link defined as follows:
<a href="" id="clrest">Restrict</a>
Now, in my JS function, I'm disabling/enabling the link as follows:
document.links[2].disabled = true;
However, I need to change my JS statement from referencing "2" to referencing whatever position that link happens to be, so I modified my code to this:
function disableLink(){
var rnum = document.getElementById("clrest").value;
document.links[rnum].disabled = true;
}
But for rnum, I keep getting "undefined". What is my problem? I thought using the getElementByID and the value attribute would return the position of that particular link.
Am I doing something wrong?
Thanks in advance for your help.
soho34