<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
    <link href="Commonality.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="Contract.js"></script>
</head>
<body onload="init();">
    <form id="form1" runat="server">
    <div id="divcenter800">
        <div id="TabOnLineDeal" class="TabNotHit">交易 </div>
        <div id="TabTransfer" class="TabNotHit">转帐 </div>
        <div id="TabModify" class="TabNotHit">变更 </div>
    </div>
    <div id="OnLineDeal" class="SelectNoteTr">
        <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True">
         <asp:ListItem>1</asp:ListItem>
         <asp:ListItem>2</asp:ListItem>
         <asp:ListItem>3</asp:ListItem>
        </asp:DropDownList>
    </div>
    <div id="Transfer" style="display:none;" class="SelectNoteTr">
        <asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="True">
        <asp:ListItem>4</asp:ListItem>
        <asp:ListItem>5</asp:ListItem>
        <asp:ListItem>6</asp:ListItem>
        </asp:DropDownList>
        </div>
    <div id="Modify" style="display:none;" class="SelectNoteTr">
        <asp:DropDownList ID="DropDownList3" runat="server" AutoPostBack="True">
        <asp:ListItem>7</asp:ListItem>
        <asp:ListItem>8</asp:ListItem>
        <asp:ListItem>9</asp:ListItem>
        </asp:DropDownList>
    </div>
    </form>
</body>
</html>
css------------
#divcenter800
{
margin-left: auto;
margin-right: auto;
width: 780px;
}
.TabHit
{
float: left;
background-image: url(cordhit.gif);
padding-top: 3px;
text-align: center;
height: 19px;
width: 63px;
}
.TabNotHit
{
text-align: center;
padding-top: 3px;
float: left;
cursor: hand;
height: 19px;
width: 63px;
}
.SelectNoteTr
{
margin-left: auto;
margin-right: auto;
margin-top: 2px;
width: 780px;
padding-top: 0px;
font-family: 宋体;
font-size: 12px;
height: 20px;
}javascript---------------
function SelectTabNode()
{
    var TabOnLineDeal=document.getElementById("TabOnLineDeal");
    TabOnLineDeal.className="TabNotHit" ; 
    
    var TabTransfer=document.getElementById("TabTransfer");
    TabTransfer.className="TabNotHit" ; 
    
    var TabModify=document.getElementById("TabModify");
    TabModify.className="TabNotHit" ;             
            
    this.className="TabHit";
    
    var OnLineDeal=document.getElementById("OnLineDeal");
    OnLineDeal.style.display="none";
    
    var Transfer=document.getElementById("Transfer");
    Transfer.style.display="none";
    
    var Modify=document.getElementById("Modify");
    Modify.style.display="none";
    
    document.getElementById(this.id.replace('Tab','')).style.display="";
}
function init()
{
    var TabOnLineDeal=document.getElementById("TabOnLineDeal");
    TabOnLineDeal.onclick=SelectTabNode;    var TabTransfer=document.getElementById("TabTransfer");
    TabTransfer.onclick=SelectTabNode;
    
    var TabModify=document.getElementById("TabModify");
    TabModify.onclick=SelectTabNode;
    
}这个层显示的已经ok了!现在最大的问题就是当我选择一个层下面的一个下拉列表里面的值(我设置了AutoPostBack="True"  这个一定要)
这个页面就老刷回去: 比如选择(转帐)下面的 DropDownList2 的值 页面就又回到(交易)这层了
我现在就是想要我选择任何一层下的DropDownList 的值  页面都不动 谢谢高手提点!!!!

解决方案 »

  1.   

    不是吧    你选择 转帐 或者 变更 它下面相应的dropdownlist也就出来了啊
      

  2.   

    想不通你为什么执意要AutoPostBack="True"
    那只好这样了
        protected void Page_Load(object sender, EventArgs e)
        {
            this.DropDownList1.Attributes.Add("onchange", "return false;");
            this.DropDownList2.Attributes.Add("onchange", "return false;");
            this.DropDownList3.Attributes.Add("onchange", "return false;");
        }
      

  3.   

    AutoPostBack="True"
    页面重新load过了 根据你的代码,你现在显示的是 转帐 这个层,页面重新load时,这个层的display又变成none了你可以这样做放一个hidden,用来存你页面load后要显示的层的id
    function SelectTabNode()里面根据这个hidden的值来确定哪个层是显示的