表单提交后出现乱码,怎么解决?急!!! 提交表单和获取表单内容都是用javascript客户端脚本,请问怎么解决? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 HTM 可以处理表单吗?不明白。 是呀!页面如下:test1.htm<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>无标题文档</title></head><body><form action="test2.htm" method="get"><input name="test" type="text" value="测试"><input type="submit" name="Submit" value="提交"></form></body></html>页面test2.htm<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>无标题文档</title></head><body><script language="javascript">function getQuery(name){ var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)"); var r = window.location.search.substr(1).match(reg); if (r!=null) return unescape(r[2]); return null;}alert(getQuery("test");</script></body></html> 我是用javascript客户端脚本处理表单的 把 unescape 换成 decodeURI 试试。 不过这个函数只有在 JS5.5 之后才有,如果考虑到兼容性,可以在表单发送之前使用 escape 对表单内容进行一下处理。 如何选中当前月份(英文)? js如何访问在函数体内动态创建的标签!!! JSP如何获取JavaScript的变量值 请问复选框返回的值是数组马 大侠请帮忙! 未结束的字符串常量~ 在线等待,按钮单击事件和页面双击事件冲突 变量如何存储多行文本? 在JS中怎么声明一个数组?我如下的方法不对,是在JAVA中声明的,JS如何声明? JQ根据select option的值,让该option被选中. 请各位高手指点,NET组件与javaScript脚本如何交互的 取IP的代码?
页面如下:
test1.htm
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head><body>
<form action="test2.htm" method="get">
<input name="test" type="text" value="测试">
<input type="submit" name="Submit" value="提交">
</form>
</body>
</html>页面test2.htm<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head><body>
<script language="javascript">
function getQuery(name)
{
var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r!=null) return unescape(r[2]); return null;
}
alert(getQuery("test");
</script>
</body>
</html>