window.location传递参数
来源:互联网 发布:阿里云盒子系统升级 编辑:程序博客网 时间:2024/06/06 01:15
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<input type="text" name="text1" id="text1" value="" />
<input type="button" name="btn1" id="btn1" value="点击" />
</body>
<script src="jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
$('#btn1').on('click',function(){
var textValue = $('#text1').val();
window.location.href = '2.html#&value_='+textValue;
})
</script>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<input type="button" name="btn2" id="btn2" value="dongtao" />
<div class="div1"></div>
</body>
<script src="jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
$(function(){
var value = getHash('value_');
$('#btn2').on('click',function(){
$('.div1').html(value);
})
})
//获取路径参数
function getHash(key, url) {
var hash;
if (!!url) {
hash = url.replace(/^.*?[#](.+?)(?:\?.+)?$/, "$1");
hash = (hash == url) ? "" : hash;
} else {
hash = self.location.hash;
}
hash = "" + hash;
hash = hash.replace(/^[?#]/, '');
hash = "&" + hash;
var val = hash.match(new RegExp("[\&]" + key + "=([^\&]+)", "i"));
if (val == null || val.length < 1) {
return null;
} else {
return decodeURIComponent(val[1]);
}
}
</script>
</html>
- window.location传递参数
- window.location.href传递汉字参数
- window.location.href传递js对象参数及获取参数
- window.location.href以post方式传递参数
- JAVASCRIPT下window.location.href通过url传递参数
- Window.location.href以post方式传递参数的方法
- Window.location.href以post方式传递参数的方法
- JS控制静态页面之间传递参数获取参数并应用(window.location)
- js获取url传递参数,js获取url?号后面的参数window.location
- js获取url传递参数,js获取url?号后面的参数window.location
- JS控制静态页面之间传递参数获取参数并应用(window.location)
- js获取url传递参数,js获取url?号后面的参数window.location
- window.showModalDialog参数传递
- window.open传递参数
- window.location.href()采用post传递数据
- window.location获取url各项参数详解
- window.location获取url各项参数详解
- 使用window.open()传递参数
- 【新闻发布系统】网站发布问题整理
- unity 滑动条控制动画播放代码
- 安卓学习笔记---Android 系统状态栏沉浸式/透明化完整解决方案
- Exception
- 使用Collections.sort对List进行排序
- window.location传递参数
- 搜狗——火眼金睛
- FrameLayout(层布局或者帧布局)的使用
- DFS_3
- C#类修饰符种类及简介
- ORACLE-REGEXP_SUBSTR函数使用方法汇总
- OSX安装Redmine Could not locate Gemfile or .bundle/directory
- 电脑上访问一个网页,整个过程是怎么样的
- poj 3695 && hdu 2461