我现在想做一个下拉框,比较简单的,就是当我选择其中一个项时,能跳转到另一个页,就是友情链接这个样子的,是很简单的,不过有一个小问题难住我了,我想另外打开新页,你们说友情链接,如果只是重定向,那是合理 ,应该是重新打开一个新页才行,可是要重新打开一个新页要怎么写啊?
我用respons.redirect是不行的用javascript中的location怎么用?
急啊,大家快帮帮忙!!

解决方案 »

  1.   

    用SELECT就可以了,代码:
    <SELECT id="select1" class="font21" onchange="javascript:window.open(document.all.select1.value);"
    name="select1">
    <OPTION value="" selected>友情链接</OPTION>
    <OPTION value="http://www.sina.com.cn/">++新浪网++</OPTION>
    <OPTION value="http://www.163.com">++网易++</OPTION>
    </SELECT>
      

  2.   

    <asp:DropDownList id="DropDownList1" style="Z-INDEX: 101; LEFT: 160px; POSITION: absolute; TOP: 56px"
    runat="server" Width="64px" Height="40px" AutoPostBack="True">
    <asp:ListItem Selected="True"></asp:ListItem>
    <asp:ListItem Value="http://www.sina.com.cn/">新浪</asp:ListItem>
    <asp:ListItem Value="http://www.163.com">网易</asp:ListItem>
    </asp:DropDownList>
    private void InitializeComponent()
    {    
    this.DropDownList1.SelectedIndexChanged += new System.EventHandler(this.DropDownList1_SelectedIndexChanged);
    this.DropDownList1.PreRender += new System.EventHandler(this.DropDownList1_PreRender);
    this.Load += new System.EventHandler(this.Page_Load); }
    private void DropDownList1_SelectedIndexChanged(object sender, System.EventArgs e)
    { string script = string.Format(@"<script language=javascript>window.open ('{0}', 'newwindow', 'height=10, width=10, top=10, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no;');</script>",DropDownList1.SelectedValue);

    Response.Write(script);

    }