Author
onbefore unload
sandhya sri
Greenhorn
Joined: Feb 11, 2009
Posts: 16
By Clicking on an image I am opening one jsp as a seperate window(popup1). When I close this popup window by clicking on window CLOSE button, one more window should open i.e., popup2. In this case popup window should not close.
for that I am using follwing code, but its not working...
<HTML>
<HEAD>
</HEAD>
<body onLoad="check(false);" onUnLoad="check(true);">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#A3D1FF" >
<form method="post" name="theForm">
<tr>
<td colspan=3 width="100%" height="30" align='<%=leftAlign%>'><span class="darkbluefont13"><strong> </strong></span></td>
</tr>
<tr>
<td width="10%"> </td>
<% String s = "siebelcrm/EBI/"+campId+"/offer.html";%>
<td width="60%" align="center" style="padding:0px 0px 0px 12px"><jsp:include page="<%=s%>"/> </td>
</tr></table></td>
<td width="10%"> </td>
</tr>
<tr height="10%"><td colspan=3 width="100%" height="30" align='center'><span class="darkbluefont13"><strong> </strong></span></td></tr>
<tr>
<td width="2%" align='center'> </td>
<td align="center">
<table border="0"><tr>
<td>
<a href="#" onclick="check(false);"><img src="apply.gif" alt="banner" border="0"></a>
<a href="#" onclick="check(false);"></a>
</td>
</tr></table></td>
</tr>
<tr>
<td colspan=3 width="100%" height="30" align='<%=leftAlign%>'><span class="darkbluefont13"><strong> </strong></span></td>
</tr>
</form>
</table>
<%
}
%>
<script type="text/javascript" language="JavaScript">
var flag;
function check(f){
flag=f;
}
if(flag){
window.onbeforeunload = confirmExit;
}
function confirmExit()
{
child2=
window.open('enbdCampaignOffer2.jsp?campaignid=<%=campId%>&targetid=<%=targetId%>&contid=<%=contactId%>&treatid=<%=treatId%>','call','dependent=no,directories=no,location=no,menubar=no,status=no,titlebar=no,toolbar=no,scrollbars=yes,resizable=yes,hotkeys=no,width=500,height=110');
return child2;
}
</script>
</body>
</html>
Please suggest me correct approch to meet my requirement.
Thanks in advance.
sandhya sri
Greenhorn
Joined: Feb 11, 2009
Posts: 16
screenshot
popupscrnshot.png
sandhya sri
Greenhorn
Joined: Feb 11, 2009
Posts: 16
pfa
<html>
<head>
<SCRIPT type="text/javascript" src="js/jquery-1.4.2.min.js"></SCRIPT>
<SCRIPT type="text/javascript" src="js/jquery.blockUI.js"></SCRIPT>
<script type="text/javascript">
var LOADINGIMAGE = 'HELLO WORLD';
function callblock(){
var el = document.createElement("iframe");
el.setAttribute('id', 'blockUIiframe');
el.height = "100%";
el.width = "100%";
el.scrolling = "yes";
if(document.getElementById("showBlockUI")!=null){
document.getElementById("showBlockUI").appendChild(el);
el.setAttribute('src', "file:///C://Users/Shirisha/Desktop/sample_abc/sample/popup.html");
$.blockUI({message: $('#blockUIiframe')});
}
}
</script>
</head>
<body>
<div id="showBlockUI_Parent" height="100%">
<div id="showBlockUI"></div>
</div>
<img src="Nice.jpg" onclick="javascript:callblock()"/>
</body>
</html>
popup
-------
<html>
<head>
<style type="text/css">
#tutors-popup {
position: fixed;
top: 0;
right: 0;
}
</style>
<script type="text/javascript">
function openPopup()
{
myWindow=window.open('','','width=800,height=600')
myWindow.document.write("<html><head></head><body>promt user and close</body></html>")
myWindow.focus();
}
</script>
</head>
<body >
<div id="tutors-popup">
<img alight="right" src="close_button.png" id="fullPic" onclick="openPopup();"/>
</div>
<div>test pop up page 1 </div>
</body>
</html>
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56178
pfa?
And did you read the link I posted?
[Smart Questions ] [JSP FAQ ] [Books by Bear ] [Bear's FrontMan ] [About Bear ]
subject: onbefore unload