3
4

2 回答 2

3

Simply add a client-side onclick handler to your listbox as shown below:

<asp:ListBox id="ListBox1" runat="server" .....
           onclick="openPopup(this)">
        ........
</asp:ListBox>

Then add the following javascript code:

<script type="text/javascript">
    function openPopup(e){
      window.open(e.value); 
    }
</script>
于 2009-06-18T21:19:31.283 回答
0

Sure, this should be pretty easy with jQuery. Obviously the URL generation could be reduced to a single statement, but should give you the general idea.

$(document).ready(function() {
    $("your-element").click(function() {
        var str = $("#listbox-id").val();
        var url = "your-url.com/" + str;
        window.open(url);
    });
});
于 2009-06-18T21:16:41.913 回答