2013年9月26日星期四

window.open () to set parent page sub-page display value


function simplePrint(){
  var win = null;
  win = window.open("simplePrint.jsp","win");
  var delegateOrgName = document.getElementById('DelegateOrgName').value;
  //alert(delegateOrgName);
  win.document.getElementById("applicant").innerHTML = delegateOrgName; 
  }

open the parent page sub-page , set the sub-pages values ​​, I use the code above can be achieved, but when I open the sub- pages close contact do not open and close the sub-pages repeat the operation, the value of a sub- page will , and no one will be , and generally are not first opened , but if I add an alert (delegateOrgName); when , in respect of each sub-pages can take to value , there is no better way to achieve the parent page to the newly opened subpages assigned.
I realize the function is to print a part of the parent page above data, that is a simple print , you need to extract the parent page to be printed above the data into sub- page, and then print subpages . Other methods can achieve better introduced to me , try to detail oh. Thank you !

------ Solution ------------------------------------ --------
parent object can get the value of the parent page
------ Solution -------------------- ------------------------
subpages write
 window.returnValue ="想返回的值";

parent page directly receive

var value = window.open("","");
alert(value);


value is the value returned subpages
------ Solution ----------------------------- ---------------
why it does not open subpages values ​​directly pass over it ?
window.open ("simplePrint.jsp? DelegateOrgName = ...", "win");

------ Solution ------------------------------------ --------


But this is almost the best add a random number of parameters
------ Solution --------------------- -----------------------

    
But this is almost the best add a random number of parameters          
Could you elaborate a little ?  
get requests transmitted through hanging over .. URL parameters
------ Solution --------------------- -----------------------

        
But this is almost the best add a random number of parameters                      
Could you elaborate a little ?                
get requests transmitted through hanging over .. URL parameters          
  
But I subpages alert when the value can not get to , alert ("$ { parameter name } " ) ;  

javascript there location.search
can get through this url? value .. During the subsequent split .
------ For reference only ------------- --------------------------

I was directly open a jsp page , as follows:
window.open ("simplePrint.jsp", "win");
But I use the following js, can not get to the desired value.
window.parent.document.getElementById ("DelegateOrgName")
------ For reference only --------------------- ------------------



I was wrong . was to spread the past ah .. sorry ..

right upstairs !

------ For reference only ---------------------------------- -----

I subpages on alert, taking less than a value , as follows:
alert("${delegateOrgName}");

------ For reference only ----------------------------------- ----

  
  
I was wrong . was to spread the past ah ..    sorry ..   
  
right upstairs !   
 

still very grateful !
------ For reference only -------------------------------------- -

  
But this is almost the best add a random number of parameters  
Could you elaborate a little ?
------ For reference only -------------------------------------- -

      
But this is almost the best add a random number of parameters                
Could you elaborate a little ?          
get requests transmitted through hanging over .. URL parameters  

But I subpages alert when the value can not get to , alert ("$ { parameter name }");
------ For reference only -------- -------------------------------

          
But this is almost the best add a random number of parameters                            
Could you elaborate a little ?                      
get requests transmitted through hanging over .. URL parameters                
    
But I subpages alert when the value can not get to , alert ("$ { parameter name } " ) ;          
  
javascript there location.search   
can get through this url? future value .. making splits.  

Thank you, has been resolved, but one thing I still do not know, I remember the jsp page can be directly used by value between $ { value } This way , do not know why there can not.
------ For reference only -------------------------------------- -

            
But this is almost the best add a random number of parameters                                  
Could you elaborate a little ?                            
get requests transmitted through hanging over .. URL parameters                      
      
But I subpages alert when the value can not get to , alert ("$ { parameter name } " ) ;                
    
javascript there location.search     
can get through this url? future value .. making splits.          
  
Thank you, has been resolved, but one thing I still do not know, I remember the jsp page can be directly used by value between $ { value } This way , do not know why there can not.  
$ {} This is an EL expression ah ... EL expression evaluates to Page request session application range of values ​​, etc.

To use an EL expression values ​​, we must first put these scoped ..
For example, in the servlet request.setAttribute ("aa", "fdafafda");
Then in the jsp page to $ {aa} value !

没有评论:

发表评论