如何在Javascript中的window.open()中传递变量并在另一页面上显示它 [英] How to pass Variable in window.open() in Javascript and Display it on another page

查看:680
本文介绍了如何在Javascript中的window.open()中传递变量并在另一页面上显示它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Javascript中传递window.open()中的变量并在另一页上显示它

===================== =======



朋友们,

我想在window.open中传递变量并将其显示在另一个网页上。

我这里有Page1和Page2



 <   script     type   =  text / javascript >  
function PopupSelectedDate()
{
var viewportwidth = document.documentElement.clientWidth;
var viewportheight = document.documentElement.clientHeight;
var PassTime =
window.resizeBy(-200,0);
window.moveTo(0,0);
window.open(Page2.aspx,mywindow,width = 420,height = 650,top = 0,screenX = 1000,screenY = 1000);

}
< / script >





请帮助

谢谢。

解决方案

  var  myVariable = '  hello world'; 
window.open( page2.aspx?myvar = + encodeURI(myVariable), mywindow width = 420,height = 650,top = 0,screenX = 1000,screenY = 1000);



获取变量使用



 Request.QueryString [myvar] 


How to pass Variable in window.open() in Javascript and Display it on another page
============================

Hi friends,
I want to Pass Variable in window.open and display it on another webpage.
I have Page1 and Page2 here

<script type="text/javascript">
 function PopupSelectedDate()
    {
var viewportwidth = document.documentElement.clientWidth;
var viewportheight = document.documentElement.clientHeight;
var PassTime =
window.resizeBy(-200,0);
window.moveTo(0,0);
window.open("Page2.aspx", "mywindow","width=420, height=650, top=0, screenX=1000, screenY=1000");

    }
</script>



Please help
THANKS.

解决方案

var myVariable = 'hello world';
window.open("page2.aspx?myvar=" + encodeURI(myVariable), "mywindow", "width=420, height=650, top=0, screenX=1000, screenY=1000");



on your page2.aspx get the variable using

Request.QueryString["myvar"]


这篇关于如何在Javascript中的window.open()中传递变量并在另一页面上显示它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆