Javascript-форум (https://javascript.ru/forum/)
-   Events/DOM/Window (https://javascript.ru/forum/events/)
-   -   как прочитать стиль элемента , заданный через css (https://javascript.ru/forum/events/11101-kak-prochitat-stil-ehlementa-zadannyjj-cherez-css.html)

KOLANICH 06.08.2010 17:57

как прочитать стиль элемента , заданный через css
 
как прочитать стиль элемента , заданный чисто через css
то есть element.style.display="", а нужно узнать что на этот счёт написано в css

JsLoveR 06.08.2010 18:07

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<p id="b" style="display:none;"></p>
<script type="text/javascript">
alert(document.getElementById("b").style.display);
</script>
</body>
</html>

KOLANICH 06.08.2010 18:10

Цитата:

Сообщение от JsLoveR (Сообщение 66626)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style>
.a{display:none;}

</style>
</head>

<body>
<p class="a" id="b">qwerty</p>
<script type="text/javascript">
alert(document.getElementById("b").style.display);
document.getElementById("b").style.display="block";
alert(document.getElementById("b").style.display);
</script>
</body>
</html>

а так

JsLoveR 06.08.2010 18:29

KOLANICH, здесь есть статейка http://sartas.ru/javascript-poluchen...-iz-css-fajla/

KOLANICH 07.08.2010 10:39

спасибо


Часовой пояс GMT +3, время: 10:08.