时间:2021-07-01 10:21:17 帮助过:2人阅读
这里写了两个网页
因为URL传过去的数据不支持中文字符和一些特殊符号 所以需要转换一下编码
实现效果:网页1的表单数据传到网页2并显示出来
网页1代码如下:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>document</title>
</head>
<body>
<!--test_form.html为需要发送数据到的网页,https://idaobin.com/test/test_form.html -->
<!--表单数据将通过method属性附加到 URL上-->
<!--submit表单提交到另一个网页-->
<form action="test_form.html" method="GET" target="_blank">
账号:<input type="text" name="code"><br>
姓名:<input type="text" name="str"><br>
<input type="submit">
</form>
</body>
</html>网页2代码如下:
运行后:

相关推荐:
JS向iframe中表单传值的实现方法
HTML表单传值示例通过get方式传递
JS和PHP中URL编码转换:escape()、encodeURI()、encodeURIComponent()
以上就是JS表单传值和URL编码转换知识点分享的详细内容,更多请关注Gxl网其它相关文章!