-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStyleSheetsExample.htm
More file actions
executable file
·35 lines (32 loc) · 1.08 KB
/
Copy pathStyleSheetsExample.htm
File metadata and controls
executable file
·35 lines (32 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<!DOCTYPE html>
<html>
<head>
<title>Style Sheets Example</title>
<link rel="stylesheet" title="blah" type="text/css" href="stylesheet1.css">
<link rel="alternate stylesheet" type="text/css" href="stylesheet2.css">
<style type="text/css">
#myDiv {
background-color: blue;
width: 100px;
height: 200px;
}
</style>
<script type="text/javascript">
function outputStyleSheets(){
var sheet = null;
for (var i=0, len=document.styleSheets.length; i < len; i++){
sheet = document.styleSheets[i];
alert(sheet.href);
}
}
function toggleStyleSheet(){
document.styleSheets[0].disabled = !document.styleSheets[0].disabled;
}
</script>
</head>
<body>
<div id="myDiv"></div>
<input type="button" value="Output Style Sheets" onclick="outputStyleSheets()">
<input type="button" value="Enable/Disable Style Sheet" onclick="toggleStyleSheet()">
</body>
</html>