1 |
wakaba |
1.1 |
<html xmlns="http://www.w3.org/1999/xhtml" |
2 |
|
|
lang="en" xml:lang="en"> |
3 |
|
|
<head> |
4 |
|
|
<title>Pseudo Pseudo Class “hover” for WinIE</title> |
5 |
|
|
<style type="text/css"> |
6 |
|
|
li { |
7 |
|
|
behavior: expression(function (el) { |
8 |
|
|
el.onmouseover = function () { this.className += ' hover' }; |
9 |
|
|
el.onmouseout = function () { this.className = this.className.replace (/\\s*hover\\b/g, '') }; |
10 |
|
|
runtimeStyle.bahavior = 'none'; |
11 |
|
|
} (this)); |
12 |
|
|
} |
13 |
|
|
li.hover { |
14 |
|
|
color: red; |
15 |
|
|
background-color: white; |
16 |
|
|
} |
17 |
|
|
</style> |
18 |
|
|
</head> |
19 |
|
|
<body> |
20 |
|
|
<h1>Pseudo Pseudo Class “hover”</h1> |
21 |
|
|
|
22 |
|
|
<div class="section" id="EXAMPLE"> |
23 |
|
|
<h2>Test</h2> |
24 |
|
|
|
25 |
|
|
<ul> |
26 |
|
|
<li>List item 1</li> |
27 |
|
|
<li>List item 2</li> |
28 |
|
|
<li>List item 3</li> |
29 |
|
|
<li>List item 4</li> |
30 |
|
|
</ul> |
31 |
|
|
</div> |
32 |
|
|
|
33 |
wakaba |
1.2 |
<div class="section" id="SOURCE"> |
34 |
|
|
<h2>Source</h2> |
35 |
wakaba |
1.1 |
|
36 |
wakaba |
1.2 |
<div class="section" id="SOURCE-DOC"> |
37 |
|
|
<h3>Document Fragment</h3> |
38 |
|
|
|
39 |
|
|
<pre><code class="HTML"><<code class="HTMLe">ul</code>> |
40 |
|
|
<<code class="HTMLe">li</code>>List item 1</<code class="HTMLe">li</code>> |
41 |
|
|
<<code class="HTMLe">li</code>>List item 2</<code class="HTMLe">li</code>> |
42 |
|
|
<<code class="HTMLe">li</code>>List item 3</<code class="HTMLe">li</code>> |
43 |
|
|
<<code class="HTMLe">li</code>>>List item 4</<code class="HTMLe">li</code>> |
44 |
|
|
</<code class="HTMLe">ul</code>></code></pre> |
45 |
|
|
|
46 |
|
|
<p class="note memo">Only! No <code class="HTMLa">onmouseover</code> |
47 |
|
|
is required in HTML documents!</p> |
48 |
|
|
|
49 |
|
|
</div> |
50 |
|
|
|
51 |
|
|
<div class="section" id="SOURCE-STYLE"> |
52 |
|
|
<h3>Style Sheet Fragment</h3> |
53 |
|
|
|
54 |
|
|
<pre><code class="CSS"><code class="HTMLe">li</code> { |
55 |
wakaba |
1.1 |
behavior: expression(function (el) { |
56 |
|
|
el.onmouseover = function () { this.className += ' <em>HOVER</em>' }; |
57 |
|
|
el.onmouseout = function () { this.className = this.className.replace (/\\s*<em>HOVER</em>\\b/g, '') }; |
58 |
|
|
runtimeStyle.bahavior = 'none'; |
59 |
|
|
} (this)); |
60 |
|
|
} |
61 |
wakaba |
1.2 |
<code class="HTMLe">li</code>:hover <code class="comment">/* For CSS compliant user agents */</code>, |
62 |
|
|
<code class="HTMLe">li</code>.<em>HOVER</em> <code class="comment">/* For WinIE */</code> { |
63 |
wakaba |
1.1 |
color: red; |
64 |
|
|
background-color: white; |
65 |
|
|
}</code></pre> |
66 |
|
|
|
67 |
wakaba |
1.2 |
</div> |
68 |
wakaba |
1.1 |
</div> |
69 |
|
|
|
70 |
|
|
</body> |
71 |
|
|
</html> |