- I have a parent window named eventLog.jsp
- And a child window named processManager.jsp
- Parent window has a button, on clicking of the button, it calls a function getEventLogProcess().
- getEventLogProcess() will open the popup window(processManager.jsp/child window)
- My need is, i have to get the parent window button id in the on load function of child window.
eventLog.jsp:
<div class="claro" id="menuDiv141" onclick="setWidgetproperty(this.id,'x','navMenu141');" onmousedown="setMenuBarProperty('navMenu141');" onmouseup="setDocStyle(this.id)" style="border:1px dotted white; left: auto; position: absolute; top: 620px;">
<div dojotype="dijit.MenuBar" id="navMenu141" style="font-size:11pt;" title="MenuBar">
<div dojotype="dijit.MenuBarItem" id="SearchMenu141" onclick="getEventLogProcess();setMenuId(this.id);" style="font-size:11pt;" title="menuBarItem">
<img class="images" id="SearchMenu141" name="search5.png" onclick="setImgProperty(this.id)" src="images/uploads/search.png" style="height:20px; width:20px;">
Search
</div>
</div>
</div>
getEventLogProcess():
function getEventLogProcess(){
if(dijit.byId('dynamiceventgridCWPROCESSEVENTLOG')){
var selctedItem = dijit.byId('dynamiceventgridCWPROCESSEVENTLOG').selection.getSelected();
if(selctedItem.length){
//alert("grid row selected");
dojo.forEach(selctedItem, function(selectedItem){
if(selectedItem !== null){
dojo.forEach(dijit.byId('dynamiceventgridCWPROCESSEVENTLOG').store.getAttributes(selectedItem), function(attribute){
var value = dijit.byId('dynamiceventgridCWPROCESSEVENTLOG').store.getValues(selectedItem, attribute);
});
}
var objectId = document.getElementById("CWPROCESSEVENTLOG.OBJECT_ID").value;
if(objectId != ""){
//alert(objectId);
popupWindowWithPost("processManager.jsp",'height=600px,width=960px,top=50px,left=150px,scrollbars=no,sizable=yes,toolbar=no,statusbar=no','processManagerpopup',objectId);
}else{
alert("Please have some value in Process ID field");
}
});
}else{
alert("grid loaded and row nt selected");
}
}
if(gbshowgridFlag==false){
alert("grid not loaded");
}
}
- I have a parent window named eventLog.jsp
- And a child window named processManager.jsp
- Parent window has a button, on clicking of the button, it calls a function getEventLogProcess().
- getEventLogProcess() will open the popup window(processManager.jsp/child window)
- My need is, i have to get the parent window button id in the on load function of child window.
eventLog.jsp:
<div class="claro" id="menuDiv141" onclick="setWidgetproperty(this.id,'x','navMenu141');" onmousedown="setMenuBarProperty('navMenu141');" onmouseup="setDocStyle(this.id)" style="border:1px dotted white; left: auto; position: absolute; top: 620px;">
<div dojotype="dijit.MenuBar" id="navMenu141" style="font-size:11pt;" title="MenuBar">
<div dojotype="dijit.MenuBarItem" id="SearchMenu141" onclick="getEventLogProcess();setMenuId(this.id);" style="font-size:11pt;" title="menuBarItem">
<img class="images" id="SearchMenu141" name="search5.png" onclick="setImgProperty(this.id)" src="images/uploads/search.png" style="height:20px; width:20px;">
Search
</div>
</div>
</div>
getEventLogProcess():
function getEventLogProcess(){
if(dijit.byId('dynamiceventgridCWPROCESSEVENTLOG')){
var selctedItem = dijit.byId('dynamiceventgridCWPROCESSEVENTLOG').selection.getSelected();
if(selctedItem.length){
//alert("grid row selected");
dojo.forEach(selctedItem, function(selectedItem){
if(selectedItem !== null){
dojo.forEach(dijit.byId('dynamiceventgridCWPROCESSEVENTLOG').store.getAttributes(selectedItem), function(attribute){
var value = dijit.byId('dynamiceventgridCWPROCESSEVENTLOG').store.getValues(selectedItem, attribute);
});
}
var objectId = document.getElementById("CWPROCESSEVENTLOG.OBJECT_ID").value;
if(objectId != ""){
//alert(objectId);
popupWindowWithPost("processManager.jsp",'height=600px,width=960px,top=50px,left=150px,scrollbars=no,sizable=yes,toolbar=no,statusbar=no','processManagerpopup',objectId);
}else{
alert("Please have some value in Process ID field");
}
});
}else{
alert("grid loaded and row nt selected");
}
}
if(gbshowgridFlag==false){
alert("grid not loaded");
}
}
Share
Improve this question
edited Feb 13, 2013 at 10:54
David
8,6907 gold badges51 silver badges71 bronze badges
asked Feb 13, 2013 at 10:53
RachelRachel
1,15911 gold badges26 silver badges43 bronze badges
1
- can anyone answer my question... please – Rachel Commented Feb 13, 2013 at 11:11
1 Answer
Reset to default 2Your code seems too plicated to me, so I wrote a test script:
Parent Window
<script type="text/javascript">
function foo(){
window.buttonid=document.getElementById('button1');
window.open("childwindow.html","child window");
}
</script>
<body>
<!-- some stuff here -->
<button id="button1" name="NiceButton" onclick="foo()">click here</button>
</body>
Child Window
<script type="text/javascript">
function loading(){
alert(window.opener.buttonid.name);
}
</script>
<body onload="loading();"></body>