有没有一种方法可以使链接在同一页面上可见,而不是在新页面上打开链接?例如,如果我在文本字段中输入“项目”并按下提交按钮,则project.htm链接会在页面上可见;如果我在文本框中写下“under”并按下提交按钮,那么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>