一个文本框,一个按钮,点击按钮(html按钮)后,用window.showModalDialog方式,弹出一个页面,选择ListBox中某一个值后,确定,返回值到文本框,根据返回值的不同,有不同的要求
比如,返回是老师,要求老师的DropDownList可用,
如果返回是学生,则学生的DropDownList可用,而老师的不可用,
问该如何实现?谢谢~~

解决方案 »

  1.   

    var str = window.showModalDialog("xxa.aspx")
    if(str=="老师")
    {
    document.all.DropDownList1.disabled=true
    document.all.DropDownList2.disabled=false
    }
    else
    {
    document.all.DropDownList2.disabled=true
    document.all.DropDownList1.disabled=false
    }注意
    DropDownList2,DropDownList1是ClientID属性输出的
      

  2.   

    private void btnClose_Click(object sender, System.EventArgs e)
            {
                if(this.ListBox1.SelectedIndex ==0)
                    Response.Write("<script>parent.document.getElementById('DropDownList1').disabled = true;window.close();</script>");
                else
                    Response.Write("<script>parent.document.getElementById('DropDownList2').disabled = true;window.close();</script>");        }
      

  3.   

    楼上的方法我试一下
    不过,Eddie005(№.零零伍) 兄的按钮是 ASP 的,
    这样的话,恐怕不能返回所选的值到页面吧当初用asp按钮就不行,用的是 html 的按钮
      

  4.   

    孟子大哥,
    DropDownList2,DropDownList1是ClientID属性输出的
    这句话什么意思啊?
      

  5.   

    没有问题
    就是孟子大哥的那个javascript代码document.all.你的某个dropdownlist的名字.disabled=true