静态页面中的下拉列表有一些值,例如人名什么的,每个名字有着不同的权限,选定一个名字,点击登录则跳转到一个页面中,不同的名字跳到不同的页面,怎么实现啊

解决方案 »

  1.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    <script type="text/javascript">
    //<![CDATA[
    function gotoUrl()
    {
    var name = document.getElementById('userName').value;
    switch(name)
    {
    case 'Andi':
    window.location.href = 'http://test.com/andi.html';
    break;
    case 'Tom':
    window.location.href = 'http://test.com/tom.html';
    break;
    case 'Kate':
    window.location.href = 'http://test.com/kate.html';
    break;
    default:
    alert("name error!");
    }
    }
    //]]>
    </script>
    </head><body>
    <select name="userName" id="userName">
    <option value="Andi">andi</option>>
    <option value="Tom" >Tom</option>
    <option value="Kate">Kate</option>
    </select>
    <input type="button" value = " 登 陆 " onclick="gotoUrl();">
    </body>
    </html>