window.opener 实际上就是通过window.open打开的窗体的父窗体。
比如在父窗体parentForm里面 通过 window.open("subForm.html"),那么在subform.html中 window.opener
就代表parentForm,可以通过这种方式设置父窗体的值或者调用js方法。
如:1,window.opener.test(); ---调用父窗体中的test()方法
2,如果window.opener存在,设置parentForm中stockBox的值。
if (window.opener && !window.opener.closed) {
window.opener.document.parentForm.stockBox.value = symbol;
}
1>window.opener 的用法
在一般的用法中,只是用来解决关闭窗口时不提示弹出窗口, 而对它更深层的了解一般比较少。其 实 window.opener是指调用window.open方法的窗口。
在工作中主要是用来解决部分提交的。这种跨页操作对工作是非常有帮助的。
如果你在主窗口打开了一个页面,并且希望主窗口刷新就用这个,打开页面的window.opener就相当于
主窗口的window。
主窗口的刷新你可以用
window.opener.location.reload();
如果你用虚拟的目录:如struts的*.do会提示你重试
你可以改成这样 window.opener.yourformname.submit()
就好了
2〉
在应用中有这样一个情况,
在A窗口中打开B窗口,在B窗口中操作完以后关闭B窗口,同时自动刷新A窗口
function closeWin(){
hasClosed = true;
window.opener.location="javascript:reloadPage();";
window.close();
}
function window.onbeforeunload(){
if(!hasClosed){
window.opener.location="javascript:reloadPage();";
}
}
</script>
上面的代码在关闭B窗口的时候会提示错误,说缺少Object,正确的代码如下:
function closeWin(){
hasClosed = true;
window.opener.location="javascript:reloadPage();";
window.opener=null;
window.close();
}
function window.onbeforeunload(){
if(!hasClosed){//如果已经执行了closeWin方法,则不执行本方法
window.opener.location="javascript:reloadPage();";
}
}
</script>
reloadPage方法如下:
function reloadPage() {
history.go(0);
document.execCommand("refresh")
document.location = document.location;
document.location.reload();
}
PS:由于需要支持正常关闭和强制关闭窗口时能捕捉到事件,用了全局变量hasClosed
==============================================
补充,在父窗口是frame的时候在刷新父窗口的时候会出现问题:
The page cannot be refreshed without resending the information.
后修改如下:
window.opener.parent.document.frames.item('mainFrame').location.href = window.opener.location.href;
不需要执行自带的reload()方法,注意,不要再画蛇添足加上这一句:
window.opener.parent.document.frames.item('mainFrame').location.reload();
========================================================================================
最后,为了同时支持刷新普通父窗口和frame父窗口,代码如下:
function closeWin() {
hasClosed = true;
<%if(null != frame){%>
window.opener.parent.document.frames.item('mainFrame').location.href = window.opener.location.href;
<%}else{%>
window.opener.location = "javascript:reloadPage();";
<%}%>
//window.opener.top.mainFrame.location="javascript:reloadPage();";
//self.opener.frames.mainFrame.location.reload(true);
window.opener = null;
window.close();
}
function window.onbeforeunload(){
if (!hasClosed) {
<%if(null != frame){%>
window.opener.parent.document.frames.item('mainFrame').location.href = window.opener.location.href;
<%}else{%>
window.opener.location = "javascript:reloadPage();";
<%}%>
window.opener = null;
}
}
关于window.opener
window.opener 的用法
window.opener 返回的是创建当前窗口的那个窗口的引用,比如点击了a.htm上的一个链接而打开了b.htm,然后我们打算在b.htm上输入一个值然后赋予a.htm上的一个id为“name”的textbox中,就可以写为:
window.opener.document.getElementById("name").value = "输入的数据";
对于javascrīpt中的window.opener没有很好的理解。
为什么框架中不能使用,弹出窗口的父窗口不能在框架里面的某个页面呢?那怎样通过弹出窗口操作框架中的父窗口呢?
opener.parent.frames['frameName'].document.all.input1.value 试试这个:)
正确使用window.open返回对象的opener
众所周知JavaScript中:
var win = window.open(url,windowName,...); 的使用,
而win.opener则是指向父窗口的引用
然而,有种情况却比较特别,
假如有两个窗口window1和window2
按下列步骤执行:
var win = window.open(url,windowName,...);// (window1)
var win = window.open(url,windowName,...);//(window2)
其中先后这两次打开的子窗口的windowName一样
此时你会发现在window2中的win.opener却不是指向window2的,却是指向window1.
如果你想在子窗口关闭父窗口的话,就不正确了,因此可以修改上面的执行方法为:
var win = window.open(url,windowName,...);? (window1)
win.opener = window;
var win = window.open(url,windowName,...);? (window2)
win.opener = window;
只有这样修改才OK
通过window.showModalDialog或者.showModelessDialog弹出的页面
这种情况需要两个步骤:1 在父窗口.showModalDialog或.showModelessDialog方法的第二个参数传递window对象比如: window.showModelessDialog('a.htm',window);2 在a.htm中就可以通过window.dialogArguments获取该参数比如: window.dialogArguments.fun1();PS:子窗口可以通过设置window.returnValue设置页面返回值
比如: window.returnValue=’OK’;window.close();
strRtn=window.showModalDialog(......)
相关推荐
linux 驱动 - pinctrl子系统
分析总结 pinctrl 子系统框架结构,平台 mtk6771 内核版本 kernel-4.4 , 本文所有的分析均基于此版本。
window.opener用法
window.opener 实际上就是通过window.open打开的窗体的父窗体。比如在父窗体parentForm里面 通过 window.open("subForm.html"),那么在subform.html中 window.opener就代表parentForm,可以通过这种方式设置父窗体的值或者调用js方法。如:1,window.opener.test(); ---调用父
2024高校网络安全管理运维赛题目--复现+题目+wp
官方writeup集思广益比较好的备份。
window.opener使用
window.opener 实际上就是通过window.open打开的窗体的父窗体。 比如在父窗体parentForm里面 通过 window.open("subForm.html"),那么在subform.html中 window.opener 就代表parentForm,可以通过这种方式设置父窗体的值或者调用js方法。 如:1,window.opener.test(); --
COMSOL仿真多模光纤弯曲损耗:从原理到工程实践
光纤弯曲损耗是光通信与光纤传感领域的基础物理现象,其本质是光波导结构变形导致模式耦合与能量泄漏。从波动光学原理出发,当光纤弯曲时,其有效折射率分布发生改变,破坏了全反射条件,使得高阶导模转化为辐射模,从而产生损耗。这一过程对光纤通信系统的传输距离、稳定性以及微型化光纤设备的设计至关重要。利用COMSOL Multiphysics的多物理场仿真能力,特别是其波动光学模块与变换光学方法,可以高效、精确地模拟弯曲半径、折射率剖面等参数对损耗的影响。该方法为光通信设计工程师和科研人员提供了强大的虚拟原型验证工具,能
基于Pixi.js的Live2D看板娘离线加载实战指南
本文详细介绍了基于Pixi.js实现Live2D看板娘离线加载的完整方案,涵盖环境搭建、模型加载、交互功能实现及常见问题解决。通过Pixi.js的硬件加速优势,开发者可在Web和Electron项目中无缝集成离线运行的Live2D模型,提升用户体验并避免网络依赖问题。
window.opener 的用法
1>window.opener 的用法 在一般的用法中,只是用来解决关闭窗口时不提示弹出窗口, 而对它更深层的了解一般比较少。其实 window.opener是指调用window.open方法的窗口。 在工作中主要是用来解决部分提交的。这种跨页操作对工作是非常有帮助的。 如果你在主窗口
CTF Web入门题目——Bugku Web 题目题解——发送HTTP请求篇(3道基础题目)
1)Bugku web基础$_GET: http://123.206.87.240:8002/get/ 题目: 思路: 关键是分析PHP代码: $what=$_get['what']———意思是用get方式提交what的值 if($what=='flag') echo 'flag{****}';———要令what变量与字符串‘flag’相等才 得到flag。 所以我们就直接在地址栏中加上?what=flag。 其中?是变量的标识,这句话表示有一个名为what,值为flag的变量。 答案为:flag{bug
window.parent和window.opener区别是什么
下面一段代码是关于window.parent和window.opener区别来讲的,我们如果要用到iframe的值传到另一框架就要用到window.opener.document.getElementById(name).value = uvalue;这种形式哦。 window.parent能获取一个框架的父窗口或父框架。顶层窗口的parent引用的是它本身。 可以用这
传输线末端短路、开路、加电感的反射系数
时,频率变化约300MHz, 出现这种偏差是因为我们的计算中将电磁波传播速率默认为。时,频率变化约300MHz, 出现这种偏差是因为我们的计算中将电磁波传播速率默认为。下图为用网络分析仪实测一长度为30cm的传输线末端加一0.6uH的线圈的反射系数。下图为用网络分析仪实测一末端短路的长度为30cm的传输线的反射系数。下图为用网络分析仪实测一末端开路的长度为30cm的传输线的反射系数。末端加电感相当于在传输线末端延长了一段后末端短路,使得相位下降速率。幅度为0dB, 相位由。幅度为0dB, 相位由。
YOLOv8【项目实战四】遥感图像目标检测:应对特殊场景的挑战,如何处理遥感图像通常具有的大尺寸、多尺度、方向多变等特点,并对 YOLOv8 进行相应调整(含源码)
遥感图像目标检测优化策略 核心挑战 图像尺寸大:遥感图像通常达数万像素,直接缩放导致小目标丢失 多尺度目标:同一图像包含几十像素的小目标和跨图像的大目标 方向多样性:目标360度任意旋转,水平框检测效果差 优化解决方案 滑动窗口分块处理: 采用1024x1024窗口大小 设置20%-30%重叠率防止边界漏检 全局坐标转换实现检测结果拼接 多尺度特征融合: 改进FPN结构增强小目标检测 自适应感受野处理不同尺寸目标 上下文信息聚合提升检测精度 旋转目标检测: 引入旋转边界框表示 角度预测分支增强方向感知 旋转
javascript网页特效——window.opener
window.opener 实际上就是通过window.open打开的窗体的父窗体。比如在父窗体parentForm里面 通过 window.open(“subForm.html”),那么在subform.html中 window.opener就代表parentForm,可以通过这种方式设置父窗体的值或者调用js方法。如: window.opener.test();—调用父窗体中的test()方法
3D iToF深度分辨率测量
本文展示了RGB-D传感器在三维测量中的高精度表现。标靶深度图显示其具备清晰、低噪、无干扰的特性,点云数据完整度高且轮廓分明。该技术已成功应用于物流(体积测量误差<1%)、工业(高反光部件装配检测)和农业(果蔬成熟度分级)等领域,验证了其硬件和算法的可靠性,能够满足不同场景下的三维测量需求。
window.parent和window.opener区别
window.parent中parent表示父窗口,比如一个A页面利用iframe或frame调用B页面,那么A页面就是B页面的parent。B页面可以通过parent访问A页面。 window.opener中的opener表示谁打开我的,比如一个A页面利用window.open弹出了B页面,那么A页面就是B页面的opener。B页面可以通过opener访问A页面。
深度学习工具包 DeepLearningToolbox
深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[](https://bitdeli.com/free "Bitdeli Badge")
最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版
Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。
跨域window.opener
事件监听: window.addEventListener(type, function, true/false); type:事件的类型(如“click”或“mousedown”或“message”或“resize”)。 function:事件触发后调用的函数。 true/false:true:先捕获 、false:先冒泡 window.postMessage() 移除监听事件: window.removeEventListener(“click”, function); ...
IEM模型,地表粗糙度模拟
利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟
window.opener 用法
window.opener 实际上就是通过window.open打开的窗体的父窗体。 比如在父窗体parentForm里面 通过 window.open("subForm.html"),那么在subform.html中 window.opener 就代表parentForm,可以通过这种方式设置父窗体的值或者调用js方法。 如:1,window.opener.test(); --
复分析 阿尔福斯(Ahlfors) 第三版答案 英文
答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案
1565




被折叠的 条评论
为什么被折叠?



