JavaScript的:
function CreateMsg() {
var MsgDOM = document.getElementById("MSG");
MsgDOM.innerHTML = "Hello, " + document.forms[0].FNAME.value + " " + document.forms[0].LNAME.value + ". You're sex is " + document.forms[0].GENDER.value;
}
HTML:
<FORM NAME="DUH">
<INPUT TYPE=TEXT NAME=FNAME>
<INPUT TYPE=TEXT NAME=LNAME>
<SELECT NAME="GENDER">
<OPTION VALUE="Male">Male</OPTION>
<OPTION VALUE="Female">Female</OPTION>
</SELECT>
<BR><BR>
<input type="button" value="Search" onclick="javascript:CreateMsg();"/>
<BR><BR>
<SPAN ID="MSG"> </SPAN>
</FORM>
答案 0 :(得分:0)
请更新像这样的JavaScript方法 -
function CreateMsg() {
var MsgDOM = document.getElementById("MSG");
var duhForm = document.forms[0];
MsgDOM.innerHTML = "Hello, " + duhForm.FNAME.value + " " + duhForm.LNAME.value + ". You're sex is " + duhForm.GENDER.value;
duhForm.target="_self"; // or _top or _parent or _blank
duhForm.action="PleaseAskTheQuestion.do";
duhForm.submit();
}
mu太短已经在同一页面上提交了表单,但是服务器太忙了;没有甜甜圈给你。 : - )