日期:2014-05-17  浏览次数:21017 次

为什么列表元素的CSS样式的值是空的?
我是想输入 <ul> <ol> 的display,margin属性.可是为什么是空的呢?

代码如下:


<!DOCTYPE   html   PUBLIC   "-//W3C//DTD   HTML   4.01   Transitional//EN "   "http://www.w3.org/TR/html4/loose.dtd ">
<html>
<head>
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=GB18030 ">
<title> Insert   title   here </title>
<style   type= "text/css ">
ol   {   margin-left:0px;   list-style-type:lower-alpha;   list-style-position:inside;   }  
  ol   li{   margin-left:0px;   border:1px   solid   black;list-style-type:upper-alpha;   }
  a{display:list-item;list-style-type:   decimal;     margin-left:80px;   }
  a:link{color:blue;}
  a:hover{color:red;}
  a:active{color:yellow;}
  a:visited{color:green;}
</style>
</head>
<body>
<h2   id= "h2 ">
省份
</h2>
<ol   id= "a "   >
<li   id= "a1 ">
湖北
</li>
<li>
湖南
</li>
<li>
浙江
</li>
</ol>
<h2>
城市
</h2>
<ul   id= "b ">
<li   id= "b1 ">
武汉
</li>
<li>
长沙
</li>
<li>
杭州
</li>
</ul>
 
 
<script   type= "text/javascript ">
 

  document.writeln( "h2   display: "+document.getElementById( "h2 ").style.display+ " <br> ");
  document.writeln( "h2   margin: "+document.getElementById( "h2 ").style.margin+ " <br> ");
    document.writeln( "a   display: "+document.getElementById( "a ").style.display+ " <br> ");
  document.writeln( "a   margin: "+document.getElementById( "a ").style.margin+ " <br> ");
  document.writeln( "a   listStyleType: "+document.getElementById( "a ").style.listStyleType+ " <br> ");
   
    document.writeln( "a1   display: "+document.getElementById( "a1 ").style.display+ " <br> ");
  document.writeln( "a1   margin: "+document.getElementById( "a1 ").style.marginLeft   + " <br> ");
//   alert(document.getElementById( "a1 ").style.marginLeft);
    document.writeln( "b   display: "+document.getElementById( "b ").style.display+ " <br> ");
  document.writeln( "b   margin: "+document.getElementById( "b ").style.margin+ " <br> ");
 
    document.writeln( "b1   display: "+document.getElementById( "b1 ").style.display+ " <br> ");
  document.writeln( "b1   margin: "+document.getElementById( "b1 ").style.margin+ " <br> ");

 
</script>
</body>
<