Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: IE 5.5: Controlling a window from another window


Message #1 by "Susan Henesy" <susan.henesy@u...> on Tue, 23 Oct 2001 17:09:02
Sounds good..

I was thinking you had a dynamic serverside (database or whatever) value
that you needed to put into a javascript variable.. 

I guess I missed your point. (I have been in the woods hiking the last 3
days.. So im trying to get back up to speed (even at norm it isnt all
that fast:-)

daniel

--------------------------
Daniel O'Dorisio
daniel@o...
www.odorisio-networks.com
--------------------------

-----Original Message-----
From: Susan Henesy [mailto:susan.henesy@u...] 
Sent: Tuesday, October 23, 2001 9:52 PM
To: javascript
Subject: [javascript] RE: IE 5.5: Controlling a window from another
window


Hi, Daniel!

Guess what -- I finally got my code to work!  The resulting code is
posted 
below.  I only have one question about it, though -- for reports where 
intRoleNum.value has been set to "Empty", the new windows open and then 
paint themselves TWICE. Ugh.  It doesn't happen quite that way for the 
reports that actually have "strRoleNum = Request.Form("intRoleNum") 
written in them.  I wonder whassamattuh???  Does it have to do with my 
form target, which I've set to "_new"?  Should I try setting it to 
something else??  And is "frmReports.target" what should go in the "id" 
parameter of my window.open event?  Should something else go there?  If 
so, what? (Oops, I guess all those are more than one question!)

Oh, and one question for you, Daniel... I'm not sure why I would use an 
ASP variable, per the code you wrote in your previous message? I mean...

once we have the table created where the Role number might be held, I 
could see using the ASP variable then, but for now I have just written
the 
numbers into the onClick event of each button (e.g.:  onClick="fncSubmit
('Report1.asp',2)").  Did I miss your point??  You know how I'm capable
of 
doing that!

Anyway, thanks again for all the help!  I'm so glad there's somewhere to

turn when I'm stuck in a rut :).

Susan

/////////////////////////////////////////////////////

---------------------------------------------------------
HERE'S THE CODE THAT IS CURRENTLY WORKING SEMI-GROOVILY:
---------------------------------------------------------

var strReportName
var intSessRoleNum
var strReportLocation
var winReports

function fncSubmit(strReportName, intSessRoleNum){ 
/***************************************************
/*   This function opens up each Report in a new 
/*   window.  If the window is already open, then
/*   the existing new window closes, and the next
/*   report is opened in a fresh new window.  This 
/*   is to prevent "refresh" problems with Crystal.
/*
/***************************************************/
	   
//Assign the Report file value to strReportLocation. 
strReportLocation = "./reports/" + strReportName;
			
  // If a the winReports window already exists, close it
  if (winReports && !winReports.closed) {
       winReports.close();
  }

  // If intSessRoleNum is equal to 0, then set it to Empty;
  // the reports do not need this value to operate.
  if(intSessRoleNum = 0) {
    document.frmReports.intRoleNum.value = Empty;
  }
  // If intSessRoleNum is > 0, then make sure that 
  // the hidden field "intRoleNum" carries the value to
  // the requested report.
  else {
    document.frmReports.intRoleNum.value = intSessRoleNum;
  }

  //------------------------------------------------------------
  // Whether intSessRoleNum is Empty or greater:
  // *  Post it to the requested report with the action method
  // *  Submit frmReports
  // *  Make submitting frmReports opens a new window that:
  //     -- controls which window features will be visible
  //     -- has the name "winReports"
  //------------------------------------------------------------
    document.frmReports.intRoleNum.value = intSessRoleNum;
    document.frmReports.action = strReportLocation;
    document.frmReports.submit(winReports 
window.open(strReportLocation, 
      frmReports.target,'scrollbars=0,toolbar=0,menubar=0,location=0, 
      status=0,resizable=1'));
}

//-->
</SCRIPT>

<HTML>
<BODY>
<FORM NAME="frmReports" METHOD="POST" TARGET="_new">
<INPUT TYPE="Hidden" id="intRoleNum" name="intRoleNum">

<!-- Buttons go here.. here's an example of two of them... -->

<!-- Report 1 Button -->
<INPUT TYPE="button" id="cmdReport1" name="cmdReport1" value="Report 1" 
onClick="fncSubmit('Report1.asp',0)">

<INPUT TYPE="button" id="cmdReport2" name="cmdReport2" value="Report 2" 
onClick="fncSubmit('Report2.asp,2)">

</FORM>
</BODY>
</HTML>


-------------------------------------------------------------------


daniel@o... 
$subst('Email.Unsub')


  Return to Index