🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: pl.comp.lang.javascript
1 messages
1 total messages Started by takeshin Wed, 02 Sep 2009 07:55
pobrać kolor a:hover
#49280
Author: takeshin
Date: Wed, 02 Sep 2009 07:55
43 lines
2553 bytes
Jak za pomocą JS można pobrać kolor linku po najechaniu?

Chcę zrobić testową stronę, która pokazywałaby wszystkie stany linków
(hover, active, focus itd.)

Próbowałem za pomocją JQuery, ale wygląda na to, że te przypadki nie
są obsługiwane.

Poniżej przykład nie działający.
Działa, jeśli się zamieni a:hover na samo a

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl" lang="pl">
    <head>
        <meta http-equiv="content-type" content="text/html;
charset=UTF-8" />
        <title>Navtest</title>
        <link rel="stylesheet" type="text/css" href="screen.css" />
        <script type="text/javascript" src="http://
jqueryjs.googlecode.com/files/jquery-1.3.2.min.js"></script>
        <script type="text/javascript">
            /*<![CDATA[*/
                $(function() {
                  var color = $('a:hover').eq(0).css('color');
                  alert(color);
                  $('.hovered').css('color', color);
                })
            /*]]>*/
        </script>
    </head>

    <body id="index">
        <div id="page-container">
        <h1 id="main">Navtest</h1>

        <ul>
            <li><a href="#">test link</a></li>
            <li><a class="hovered" href="#">test link hover</a></li>
        </ul>
        </div>
    </body>
</html>
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads