我想用dropdownlist(WEB控件)做个友情连接,selectindex改变时,自动弹出新窗口,该怎么做,请大家帮忙

解决方案 »

  1.   

    AutoPostBack设为True在SelectedIndexChanged事件内
    {
       Response.Write("<script>window.Open('"+要打开页面的uri+"')</script>");
    }
      

  2.   

    for  i as int32 to dropdownlist1.items.count-1
    dropdownlist1.items(i).attribute.add("onchang","window.open('"& this.value &"','','toolbar=no,menubar=no');")
    next
      

  3.   

    使用脚本
    this.DropDownList.Attributes.Add("onchange","window.open(this.value,'','');");
    其中,这个下拉框的值,必须为如下
    <option value="http://www.sina.com.cn">新浪</option>
      

  4.   

    Dim item1 As New ListItem
            item1.Text = "新浪"
            item1.Value = "http://www.sina.com.cn"
            Dim item2 As New ListItem
            item2.Text = "网易"
            item2.Value = "http://www.163.com"
            Me.DropDownList1.Items.Add(item1)
            Me.DropDownList1.Items.Add(item2)
            Me.DropDownList1.Attributes.Add("onchange", "window.open(this.value,'','');")
      

  5.   

    if (!IsPostBack)
    {
    //this.DropDownList1.Attributes.Add("onchange","window.open(this.value,'','');");
    this.DropDownList1.Attributes.Add("onchange","openvalue(this,this.value)");
    string js=@"<script langugae=""javascript"">";
    js += @" function openvalue(selobj,selvalue)";
    js += @"{";
    js += @"alert('aaaa');";
    js += @"if (selobj.value!="""")";
    js += @"{";
    js += @"window.open(selvalue);"; 
    js += @"selobj.selectedIndex=0;";
    js += @"}";
    js += @"}";
    js += @"</script>";
    this.RegisterClientScriptBlock("onchange",js);
    }
    dropdownlist1的autopostback=false;
      

  6.   

    <SELECT class="text home" id="home" name="home">
    <option value="http://www.zzu.edu.cn" selected>郑州大学</option>
    <option value="http://news.163.com">网易</option>
    <option value="http://www.csdn">csdn</option>
    </SELECT>
    <button onclick="if(document.getElementById('home').selectedIndex==1) return;location=document.getElementById('home').value"
    type="button">go </button>
      

  7.   

    this.DropDownList.Attributes.Add("onchange","window.open(this.value,'','');");
    这短代码为什么编译不过去?
    levin9(工作电脑不能上网) 的可以,谢谢
      

  8.   

    this.DropDownList.Attributes["onchange"] = "window.open(this.selectItem.value);";
    试试,//DropDownList写成你的控件名,编译是没问题的,如果JS有错那就是可能selectItem写错了