首页 > 学习笔记 > PHP > 正文

选择select下拉项跳转页面

发布时间:2016-09-21 14:08:50 点击量:


<div>
                        <select onchange=mbar(this) name="select">
                            <option selected>友情链接</option>
                            <option value="http://www.163.com">163</option>
                            <option value="http://www.baidu.com">百度</option>
                        </select>

</div>

js代码:

<script type="text/javascript">

                    function mbar(sobj) {
                    var docurl =sobj.options[sobj.selectedIndex].value;
                    if (docurl != "") {
                       open(docurl,'_blank');
                       sobj.selectedIndex=0;
                       sobj.blur();
                    }
                    }

</script>

上一篇:phpcms v9字符串替换函数

下一篇:phpstudy的301定向设置方法