JavaScript无法从母版页正常工作. [英] JavaScript not working properly from Master Page..

查看:78
本文介绍了JavaScript无法从母版页正常工作.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已在母版页"中编写了JavaScript.
我有两个aspx页面.一个aspx页面作为主页,另一个作为弹出窗口.
我从主页面调用 it popupwindow.
在javascript中,我在超时时扩展了会话.对于主页,它工作正常,但是对于弹出窗口,它却无法工作,因为打开了两个页面实例.在弹出窗口中,它两次调用javascript并覆盖其值.

I have written my javascript in Master Page.
I have two aspx pages. One aspx page as main page, and another as popup window.
I am calling itthe popupwindow from Main page.
In javascript I am extending session when it timeout. It''s working fine for Main page, but not working for popup window because of two instance of pages are open. On popup window it''s calling javascript two times and override it''s value. Does anybody have an idea about this?

推荐答案

我认为这可能是您需要的:根据需要进行调整:

I think this may be sort of what you need: adapt as required:

// Used to track a popup window: only allows one version to open at a time.
var popup;

// The window attributes: this does not work correctly in IE6: who cares? :-)
var attr = "status=0,toolbar=0,menubar=0,directories=0,resizable=0,scrollbars=1";

// Opens a window.
function OpenWin(window) {
	if (!popup || popup.closed) {
		popup = window.open(window, '', attr);
	}

	popup.focus();
}


这篇关于JavaScript无法从母版页正常工作.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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