日期:2014-05-16  浏览次数:20348 次

js控制显示
1 第一种:

<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<script language="javascript">
function showv()
{
      var tr1=document.getElementById("tr1");
   tr1.style.display="";
   var sobj=document.getElementById("sv");
   alert(sobj.value);
   var optionsv="";
   for(k=0;k<sobj.options.length;k++)
   {
      optionsv=optionsv+","+sobj[k].value;
   }
   alert(optionsv);
}
</script>
<body>
<table width="200" border="1" align="center">
<tr>
    <td><input type="button" onclick="showv()" value="列表的值给我出来"/></td>
</tr>
<tr id="tr1" style="display:none">
    <td>
   <select name="sv" id="sv">
     <option value="A">111</option>
     <option value="B">222</option>
     <option value="C">333</option>   
   </select>
</td>
</tr>
</table>
</body>
</html>

2 第二种:

<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<script language="javascript">
function showv()
{
      var tr1=document.getElementById("tr1");
   tr1.style.display="";
   var sobj=document.getElementById("sv").value;
   alert("你选择的是:"+sobj);
}
</script>
<body>
<table width="200" border="1" align="center">
<tr>
    <td><input type="button" onclick="showv()" value="列表的值给我出来"/></td>
</tr>
<tr id="tr1" style="display:none">
    <td>
   <select name="sv" id="sv">
     <option value="A">111</option>
     <option value="B" selected="selected">222</option>
     <option value="C">333</option>   
   </select>
</td>
</tr>
</table>
</body>
</html>
3 第三种:

<tr id="orgattr"   style="">
                            <td align="center"><span class="style2">属性</span></td>
                            <td >
                               <select name="orgattribute" onchange="oldsubdeptcodeshowcotrol()">
                              &nb