Не получаеться вытянуть css с текущей страницы
Есть файл:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <meta name="author" content="gamer" /> <style type="text/css"> #header { width:900px; /*ширина блока*/ padding:10px; /*внутренние отступы с четырёх сторон равны 10px*/ border:1px solid #a4ce60; /*граница блока, бордюр*/ height:100px; /*фиксированная высота блока*/ margin:10px 0 5px 0; /*внешние отступы блока, в данном случае сверху и снизу*/ background:#bdda7e; /*цвет фона*/ line-height:100px; /*расстояние между строк*/ } .rule0 {color:"red"} .rule1 {color:"blue"} </style> <title>Untitled 1</title> </head> <body> [JS] function displayStyleSheetProperties() { var str = ""; if( !document.styleSheets ) { str = "Your browser does not support the stylesheets object."; } else if ( !document.styleSheets.length ) { str = "There were no stylesheets found in the document.styleSheets collection."; } else { var prop, stylesheet = document.styleSheets[0]; for (prop in stylesheet) { str += prop + ": " + stylesheet[prop] + "\n" } } alert(str); } displayStyleSheetProperties(); </script> [/JS] </body> </html> Но метод alert() не выводится, что делать? |
Часовой пояс GMT +3, время: 15:55. |