Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-25-2013, 11:45 AM   PM User | #1
BobbyRachel
New Coder

 
Join Date: Dec 2012
Posts: 11
Thanks: 2
Thanked 0 Times in 0 Posts
BobbyRachel is an unknown quantity at this point
Popup window in javascript?

I have a jsp page with button(worklistManager.jsp)... in button on click, am calling one function(getModify()) which is inside js file(utility.js).. inside that function, am doing some action and forwarding that values to next jsp page(modify.jsp) using window.location.href... the modify.jsp page should open as popup window... when i click button, it has to call the function and open the modify.jsp page as popup window... how to get this...

worklistManager.jsp:

Code:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script src="script/Utility.js" data-dojo-config="parseOnLoad: true"></script>
</head>
<body>
<div dojotype="dijit.MenuBarItem" id="SearchMenu21" onclick="getModify();" style="font-size:11pt;" title="menuBarItem">
               <img class="images" id="SearchMenu21" name="search5.png" onclick="setImgProperty(this.id)" src="images/uploads/search.png" style="height:20px; width:20px;">
               Modify
</div>
</body>
</html>
utility.js file:

Code:
function getModify(){
	var whereCondn = "";
	//alert(gbshowgridFlag);
	if(dijit.byId('dynamicgridCWPROCESS')){
		var selctedItem = dijit.byId('dynamicgridCWPROCESS').selection.getSelected();
	    if(selctedItem.length){
	    	dojo.forEach(selctedItem, function(selectedItem){
	    		if(selectedItem !== null){
	    			dojo.forEach(dijit.byId('dynamicgridCWPROCESS').store.getAttributes(selectedItem), function(attribute){
	    				var value = dijit.byId('dynamicgridCWPROCESS').store.getValues(selectedItem, attribute);
	    				//alert(value);
	    				if(attribute == "PROCESS_ID"){
	    					whereCondn = whereCondn+attribute+"="+value;
              		  	}
	    				//alert("new alert"+whereCondn);
	    				window.location.href = "modify.jsp?DETAIL="+whereCondn;
	    			});
	    		}
	    	});
	    	//alert("grid row selected");
	    }else{
	    	alert("grid row not selected");
	    }
	}
    if(gbshowgridFlag==false){
    	alert("grid not loaded");
    }
}
BobbyRachel is offline   Reply With Quote
Old 01-25-2013, 02:52 PM   PM User | #2
niralsoni
Regular Coder

 
Join Date: Mar 2008
Location: London
Posts: 129
Thanks: 1
Thanked 31 Times in 31 Posts
niralsoni is an unknown quantity at this point
Replace this line -
Code:
window.location.href = "modify.jsp?DETAIL="+whereCondn;
with -
Code:
window.open("modify.jsp?DETAIL="+whereCondn,'modifyPage','height=600px,width=800px,scrollbars=no,sizable=yes,toolbar=no,statusbar=no');
niralsoni is offline   Reply With Quote
Old 01-25-2013, 08:16 PM   PM User | #3
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,468
Thanks: 0
Thanked 499 Times in 491 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
That suggests opening in a popup - it doesn't force the browser to do so - each visitor still has the choice of opening in the same or a new tab instead just as they do with the original code which simply suggests opening in the same tab.

Which of the three possible locations a new page opens is always under the control of your visitor.
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote
Old 01-28-2013, 04:15 AM   PM User | #4
BobbyRachel
New Coder

 
Join Date: Dec 2012
Posts: 11
Thanks: 2
Thanked 0 Times in 0 Posts
BobbyRachel is an unknown quantity at this point
Quote:
Originally Posted by niralsoni View Post
Replace this line -
Code:
window.location.href = "modify.jsp?DETAIL="+whereCondn;
with -
Code:
window.open("modify.jsp?DETAIL="+whereCondn,'modifyPage','height=600px,width=800px,scrollbars=no,sizable=yes,toolbar=no,statusbar=no');

its working... thanks niralsoni... how to get the popup window in center of the page..
BobbyRachel is offline   Reply With Quote
Reply

Bookmarks

Tags
javascript

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:20 AM.


Advertisement
Log in to turn off these ads.