HTML: target=“_blank” for a drop-down list

前端 未结 4 1851
谎友^
谎友^ 2021-01-27 13:53

Problem: to open a new window with the select -option

4条回答
  •  无人及你
    2021-01-27 14:36

    Modify your handleSubmit function as follows:

    function handleSubmit()
    {
        var form = _gel("moduleForm"),
            elm = _gel("allQuery"),
            selectElm = _gel("allSelect");
        if (elm != "" && selectElm != "") {
            var query = elm.value;
            var searchUrl = selectElm.value;
            if (query != "" && searchUrl != "") {
                searchUrl += escape(query);
                window.open(searchUrl, form.target || "_blank");
            }
        }
        return false;
    }
    

提交回复
热议问题