将值从一个页面传递到另一个页面,而不是通过查询字符串 [英] Pass value from one page to another page other than by querystring
本文介绍了将值从一个页面传递到另一个页面,而不是通过查询字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要通过javascript将值从一个页面传递到另一个页面,我不想通过查询字符串传递。因为查询字符串对所有人都可见。
有没有办法将值从一个页面传递到另一个页面而不是查询字符串
谢谢
Sanju
解决方案
使用cookies: Javascript Cookies [ ^ ]
Javascript代码
函数SetCookie(cookieName,cookieValue ,nDays){
var today = new Date();
var expire = new Date();
if (nDays == null || nDays == 0 )nDays = 1 ;
expire.setTime(today.getTime()+ 3600000 * 24 * nDays);
document.cookie = cookieName + = + escape(cookieValue)
+ ; expires = + expire.toGMTString();
}
ASP.Net代码获取cookie
lblTitle.Text = Request.Cookies [ key]。值;
Hi,
I need to pass a value from one page to another through javascript, I dont want to pass by query string. because query string is visible to all.
Is there any way to pass value from one page to another page other than by query string
Thank you
Sanju
解决方案
Use cookies: Javascript Cookies[^]
Javascript code
function SetCookie(cookieName, cookieValue, nDays) { var today = new Date(); var expire = new Date(); if (nDays == null || nDays == 0) nDays = 1; expire.setTime(today.getTime() + 3600000 * 24 * nDays); document.cookie = cookieName + "=" + escape(cookieValue) + ";expires=" + expire.toGMTString(); }
ASP.Net code to get cookie
lblTitle.Text = Request.Cookies["key"].Value;
这篇关于将值从一个页面传递到另一个页面,而不是通过查询字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文