document.getElementById("poster").value="";
document.getElementById("keyword").value=txtkeywords;
document.getElementById("form1").action = "http://forum.com-edu.cn/search.aspx";;//"http://forum.com-edu.cn/search.aspx";
document.getElementById("form1").target = "_blank";
document.getElementById("form1").method = "post";
document.getElementById("form1").submit();
<form id="form1" runat="server">
<input id="keyword" name="keyword" type="hidden" />
<input name="poster" id="poster" type="hidden" />
</form>
Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8"); //防止乱码

本文介绍了一个使用JavaScript进行网页表单提交的例子。通过设置表单的属性,如目标窗口、提交方式及提交地址等,实现了关键词搜索功能,并通过响应内容编码设置避免了乱码问题。
2778

被折叠的 条评论
为什么被折叠?



