3以多动作形式提交按钮

时间:2016-07-22 07:34:08

标签: javascript html

我的编码不是很好.. 我想添加一个带有3个不同动作的按钮的表单。我有一个代码,但它对我不起作用..

<script type="text/javascript">
    function OnSubmitForm() {
        if(document.myform.operation[0] .checked == true) {
            document.myform.action = "/site_109.xhtml";
        } else if (document.myform.operation[1] .checked == true) {
            document.myform.action = "/site_110.xhtml";
        } else (document.myform.operation[2] .checked == true) {
            document.myform.action = "/site_111.xhtml";
        }
        return true;
    }
</script>
<form id="myform" name="myform" onsubmit="return OnSubmitForm ();">
    <strong><font color='oil'>Enter number:</font></strong><br>
    <input maxlength='10' name='get-no' placeholder='Mobile Number' type='text'><br>
    <strong><font color='oil'>Enter Message:</font></strong><br>
    <input name='msg' placeholder='Message' type='text'><br>
    <input checked name="operation" type="radio" value="1">Call
    <input type="radio" name="operation" value="2">Sms
    <input type="radio" name="operation" value="2">Save
    <p><input name="submit" type="submit" value="save"></p>
</form>

我希望它显示结果&#34;详细信息已成功保存&#34;提交后在同一页面上。 Plz给了我更正的代码。谢谢。

0 个答案:

没有答案