jsp页面向html页面传参
2016-03-29 20:46
507 查看
1.jsp
2.html
<!DOCTYPE html>
<html>
<head>
<title>接收参数</title>
<meta name="keywords" content="keyword1,keyword2,keyword3">
<meta name="description" content="this is my page">
<meta name="content-type" content="text/html; charset=UTF-8">
<script type="text/javascript">
function getURLParameter(name)
{
return decodeURIComponent((new RegExp("[?|&]"+name+"="+"([^&;]+?)(&|#|;|$)").exec(
location.search)||[,""])[1].replace(/\s+/g,"%20"))||null;
}
function init()
{
var name=getURLParameter("name");
var pwd=getURLParameter("pwd");
alert(name+","+pwd);
}
</script>
</head>
<body onload="init()">
</body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>jsp页面向html页面传值</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> </head> <body> <a href="events.html?name=张三&pwd=suyunlong">转到</a> </body> </html>
2.html
<!DOCTYPE html>
<html>
<head>
<title>接收参数</title>
<meta name="keywords" content="keyword1,keyword2,keyword3">
<meta name="description" content="this is my page">
<meta name="content-type" content="text/html; charset=UTF-8">
<script type="text/javascript">
function getURLParameter(name)
{
return decodeURIComponent((new RegExp("[?|&]"+name+"="+"([^&;]+?)(&|#|;|$)").exec(
location.search)||[,""])[1].replace(/\s+/g,"%20"))||null;
}
function init()
{
var name=getURLParameter("name");
var pwd=getURLParameter("pwd");
alert(name+","+pwd);
}
</script>
</head>
<body onload="init()">
</body>
</html>
相关文章推荐
- JSP/PHP基于Ajax的分页功能实现
- 在Windows 8.1的IE 11中屏蔽双击放大功能
- 开发阶段Jetty运行Jsp报错且响应空白
- Apple官网研究之使用Justify布局导航
- 通过Mootools 1.2来操纵HTML DOM元素
- jQuery Html控件基本操作(日常收集整理)
- WEB标准网页布局中尽量不要使用的HTML标签
- Flash 与 html 的一些实用技巧
- html工作中表格<tbody>标签的使用技巧
- HTML 向 XHTML1.0 兼容性指导
- jsp简单实现页面之间共享信息的方法
- C#自写的一个HTML解析类(类似XElement语法)
- Apache Web让JSP“动”起来
- 没有文件大小限制并免费的PDF到HTML转换工具
- JavaScript与HTML结合的基本使用方法整理
- css实现气泡框效果(实例加图解)
- html链接与文本标签们