The disabled
property sets or gets whether the linked document is disabled.
disabled |
Yes | Yes | Yes | Yes | Yes |
Return the disabled property.
var v = linkObject.disabled
Set the disabled property.
linkObject.disabled=true|false
Value | Description |
---|---|
true|false | Disable or enable the linked document
|
A Boolean type value, true if the linked document is disabled, otherwise false.
The following code shows how to get if the linked document is disabled.
<!DOCTYPE html>
<html>
<head>
<link id="myLink" rel="stylesheet" type="text/css" href="styles.css">
</head><!-- w w w. j a v a2 s.c o m-->
<body>
<button onclick="myFunction()">test</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.getElementById("myLink").disabled;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>
The code above is rendered as follows:
The following code shows how to disable the linked document.
<!DOCTYPE html>
<html>
<head>
<link id="myLink" rel="stylesheet" type="text/css" href="styles.css">
</head><!--from w ww . ja va 2s.c o m-->
<body>
<button onclick="myFunction()">test</button>
<p id="demo"></p>
<script>
function myFunction() {
document.getElementById("myLink").disabled = true;
}
</script>
</body>
</html>
The code above is rendered as follows: