0

新しいページでリンクを開く代わりに、次のコードで同じページにリンクを表示する方法はありますか? たとえば、テキスト フィールドに「プロジェクト」と入力して送信ボタンを押すと、project.htmリンクがページに表示されます。テキストボックスに「下」と書いて送信ボタンを押すと、underconstruction.htmリンクが表示されます。

    <script Language="JavaScript">
    <!--
        function Blank_TextField_Validator() {
            // Check the value of the element named text_name from the form named text_form
            if (text_form.text_name.value == "") {
                // If null display and alert box
                alert("Please fill in the text field.");
                // Place the cursor on the field for revision
                text_form.text_name.focus();
                // return false to stop further processing
                return (false);
            }
           // If text_name is not null continue processing
           if (text_form.text_name.value == "project")
               window.open('project.htm');
           else if (text_form.text_name.value == "under")
               window.open('underconstruction.htm');
           else
               alert("Invalid keyword!");
           return (true);
        }
    -->
    </script>
4

1 に答える 1