Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
186
rated 0 times [  187] [ 1]  / answers: 1 / hits: 19241  / 11 Years ago, sat, july 27, 2013, 12:00:00

I am trying to disable the Parent window as soon as the child window is opened. I would like to gray out the parent window whenever pop window is opened.



Below is my popup window code-



<html>
<head>
<title>Applying</title>
</head>
<body>

<script>
function getUrlVars() {
var vars = {};
var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi,
function(m,key,value) {
vars[key] = value;
});
return vars;
}
var variable1 = getUrlVars()[parameter1];

var myScript = document.createElement('script');

myScript.setAttribute('type', 'text/javascript');
myScript.setAttribute('urlId', '420');
myScript.setAttribute('dataTitle', variable1);
myScript.setAttribute('dataemail', '[email protected]');

document.body.appendChild(myScript);
</script>

<input name=Apply type=button id=Apply value=Apply ONCLICK=window.location.href='some_url'>
</body>
</html>


Below is my Parent window code-



<html>

<body>
<SCRIPT LANGUAGE=JavaScript>
<!--
function popUp(URL) {
day = new Date();
id = day.getTime();
eval(page + id + = window.open(URL, ' + id + ', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=550,height=650,left = 570,top = 300'););
}
</script>
<input type=button value=Apply onClick=javascript:popUp('popup_window_url')>
</body>
</html>


What's the best and easy way to disable the parent window here? Any example with my above code will help me a lot in understanding a simple example.



I saw various other post on the stackoverflow but I am not able to understand how to incorporate those things here in my code. I am trying to do something like this.



Any suggestions will be of great help.


More From » jquery

 Answers
24

Updated fiddle from answer in this question with iframe support http://jsfiddle.net/LT5JC/



Open function is rather simple



function open(url) {
$('#block').fadeIn(); // show grayed pane
$('#iframe').attr('src', url); // update src of iframe
$('#container').fadeIn(); // show container with iframe
}

[#76693] Friday, July 26, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
lucillemariselal

Total Points: 108
Total Questions: 97
Total Answers: 119

Location: Thailand
Member since Thu, May 6, 2021
3 Years ago
;