组合框验证

时间:2013-03-31 06:11:15

标签: html mysql

内容这是java脚本代码。用于验证组合框..验证无法正常工作..我需要你的帮助..plz帮助我..如果用户没有选择它必须显示所有的警报框树

<script type="text/javascript">
function checkseats() {
    if (!document.getElementsByName("seats")[0].selectedIndex == 1) {
        alert("Select No of Seats");
        return false;
    }
    return true;
}

function checkmovie() {
    if (document.getElementsByName("movie")[0].selectedIndex == 2) {
        alert("Please select Movie from the list");
        return false;
    }
    return true;
}

function checkdate() {
    if (document.getElementsByName("date")[0].selectedIndex == 3) {
        alert("Please select Date from the list");
        return false;
    }
    return true;
}

function validate() {
    checkdate();
    checkseats();
    checkmovie();
}
</script>

1 个答案:

答案 0 :(得分:0)

我想你想要这个,

if (document.forms["yourFormName"].seats.value == "0"){
    alert("Select No of Seats");
    return false;  
    }
    return true;
}