keinloffel
Programmer
I have a main window which opens a pop up window.
I was trying to use window.opener to manipulate the parent window and met with some problems. So I did some error checking and put the following code in the popup:
<script>
mywin = window.opener
alert(mywin)
self.close()
</script>
The alert, shows undefined, because of which none of my window.opener implementations worked.
Do i need to define the windows?? Whats going on here?
By the way I'm using JSP, and it has js embedded in it.
Thanks!!
If you want to read throught the file, here it is:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<meta http-equiv="refresh" content="1800">
<title>Harland ©2003 | ITRBO | RBO Project Management | Enter New Project - Add Originator</title>
<script language="JavaScript1.2" src="./lite.js" type="text/javascript"></script>
</head>
<body>
<%@ page language="java" import="java.sql.*"%>
<%@ page language="java" import="java.util.*"%>
<%@ page language="java" import="java.text.*"%>
<%@ page language="java" import="com.harland.prj.*" %>
<jsp:useBean id="prjb" class="com.harland.prj.PrjBean" scope="session" />
<%
String projectID = request.getParameter("projectid" ;
if(projectID == null){
%>
<jsp:forward page="./prj_home.jsp" />
<%}%>
<%
String originatoreit = request.getParameter("originatoreit"
String originatorcommon = request.getParameter("originatorcommon"
String originatorall = request.getParameter("originatorall"
%>
<% if(originatoreit != null){%>
<% if(originatoreit.equals("[Select Originator]"){%>
<script language="javascript">
window.alert("ERROR: Choose a valid Originator"
window.location="./prj_new_add_originator.jsp?projectid=<%= projectID%>"
</script>
<%} else {%>
<script>
mywin = window.opener
alert(mywin)
self.close()
</script>
<% } %>
<% } else if(originatorcommon != null){%>
<% if(originatorcommon.equals("[Select Originator]"){%>
<script language="javascript">
window.alert("ERROR: Choose a valid Originator"
window.location="./prj_new_add_originator.jsp?projectid=<%=projectID%>"
</script>
<%}%>
<%= originatorcommon%>
<%} else if(originatorall != null){%>
<%= originatorall%>
<%} else {%>
<script language="javascript">
window.alert("ERROR: Please Try Again"
window.location="./prj_new_add_originator.jsp?projectid=<%=projectID%>"
</script>
<%}%>
</body>
</html>
I was trying to use window.opener to manipulate the parent window and met with some problems. So I did some error checking and put the following code in the popup:
<script>
mywin = window.opener
alert(mywin)
self.close()
</script>
The alert, shows undefined, because of which none of my window.opener implementations worked.
Do i need to define the windows?? Whats going on here?
By the way I'm using JSP, and it has js embedded in it.
Thanks!!
If you want to read throught the file, here it is:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<meta http-equiv="refresh" content="1800">
<title>Harland ©2003 | ITRBO | RBO Project Management | Enter New Project - Add Originator</title>
<script language="JavaScript1.2" src="./lite.js" type="text/javascript"></script>
</head>
<body>
<%@ page language="java" import="java.sql.*"%>
<%@ page language="java" import="java.util.*"%>
<%@ page language="java" import="java.text.*"%>
<%@ page language="java" import="com.harland.prj.*" %>
<jsp:useBean id="prjb" class="com.harland.prj.PrjBean" scope="session" />
<%
String projectID = request.getParameter("projectid" ;
if(projectID == null){
%>
<jsp:forward page="./prj_home.jsp" />
<%}%>
<%
String originatoreit = request.getParameter("originatoreit"
String originatorcommon = request.getParameter("originatorcommon"
String originatorall = request.getParameter("originatorall"
%>
<% if(originatoreit != null){%>
<% if(originatoreit.equals("[Select Originator]"){%>
<script language="javascript">
window.alert("ERROR: Choose a valid Originator"
window.location="./prj_new_add_originator.jsp?projectid=<%= projectID%>"
</script>
<%} else {%>
<script>
mywin = window.opener
alert(mywin)
self.close()
</script>
<% } %>
<% } else if(originatorcommon != null){%>
<% if(originatorcommon.equals("[Select Originator]"){%>
<script language="javascript">
window.alert("ERROR: Choose a valid Originator"
window.location="./prj_new_add_originator.jsp?projectid=<%=projectID%>"
</script>
<%}%>
<%= originatorcommon%>
<%} else if(originatorall != null){%>
<%= originatorall%>
<%} else {%>
<script language="javascript">
window.alert("ERROR: Please Try Again"
window.location="./prj_new_add_originator.jsp?projectid=<%=projectID%>"
</script>
<%}%>
</body>
</html>