HTML 中 URL 传值。
2016-04-26 19:39
393 查看
a.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
<script>
function a()
{
var input1 = document.getElementById("inputid");
window.open("file:///C:/Users/So/Desktop/aw/b.html?inputStr=" + input1.value);//传入参数(其中,括号里面为程序文件地址)
}
</script>
<input type = "text" id = "inputid">
<input type = "button" onclick = "a()" value = "提交">
<input onclick='window.location="view-source:" + window.location.href' type="button" value="查看源文件" name="Button7">
</body>
</html>
b.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script>
//获得参数的方法
var request = {
QueryString : function(val) {
var uri = window.location.search;
var re = new RegExp("" +val+ "=([^&?]*)", "ig");
return ((uri.match(re))?(uri.match(re)[0].substr(val.length+1)):null);
}
}
</script>
</head>
<body>
<script>
//调用方法获得参数
var b = request.QueryString("inputStr");
alert(b);
</script>
<input onclick='window.location="view-source:" + window.location.href' type="button" value="查看源文件" name="Button7">
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
<script>
function a()
{
var input1 = document.getElementById("inputid");
window.open("file:///C:/Users/So/Desktop/aw/b.html?inputStr=" + input1.value);//传入参数(其中,括号里面为程序文件地址)
}
</script>
<input type = "text" id = "inputid">
<input type = "button" onclick = "a()" value = "提交">
<input onclick='window.location="view-source:" + window.location.href' type="button" value="查看源文件" name="Button7">
</body>
</html>
b.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script>
//获得参数的方法
var request = {
QueryString : function(val) {
var uri = window.location.search;
var re = new RegExp("" +val+ "=([^&?]*)", "ig");
return ((uri.match(re))?(uri.match(re)[0].substr(val.length+1)):null);
}
}
</script>
</head>
<body>
<script>
//调用方法获得参数
var b = request.QueryString("inputStr");
alert(b);
</script>
<input onclick='window.location="view-source:" + window.location.href' type="button" value="查看源文件" name="Button7">
</body>
</html>
相关文章推荐
- HTML DOM display 属性
- HTML——2(HTML 文件的结构)
- HTML——1(HTML 5 文件的基本语法)
- html中input元素的input事件对iphone原生中文输入法下的兼容问题
- html仿今日头条数据列表
- HTML DOM学习笔记
- HTML 5.1来了 9月份正式发布 更新内容预览
- PDF表单域(FormField)在HTML显示与提交数据到服务器
- servlet get post with html
- 在html中嵌入多媒体文件
- HTML--绝对路径, 表格,表单, 框架
- html获取自定义属性值
- HTML DOM 事件
- 关于 a标签
- HTML DOM 用法
- <html>文本格式化、引用、引用和术语定义
- <html>p和br
- <html>h1~h6、body、br
- HTML 事件处理
- HTML优化技巧