Solved

asp to asp semaphores

Posted on 2007-04-02
7
331 Views
Last Modified: 2008-02-07
Scenario…

Main program (asp A with Javascript and VBscript code) contains a form with dropdown to enable a user to select an item from the dropdown  to perform a utility function (back up a file).  Asp A using a javascript function changes HTML in a <div> to: “Your backup is in progress” and then does a window.open to the backup page (asp B).  Asp A stays open and visible as asp B is opened in a smaller window on top of asp A.

Asp B (with Javascript and VBscript code) performs the backup function and when done writes a <table>...</table> with an <a href=...">close window</a>.  When the user clicks the link the code should change the asp A <div> HTML to: “Your backup has been completed successfully” and then do a window.close.

The backup function works fine and the window.close works fine but I am having trouble getting asp B to change the <div> value (on asp A).  I have tried several approaches and also have done some research to check out others’ approaches—most are rather involved.

Any suggestions?

Thanks.
0
Comment
Question by:dklauk
  • 3
  • 2
  • 2
7 Comments
 
LVL 22

Expert Comment

by:WMIF
ID: 18839387
can you explain what you have tried already?  you should be able to do this with a simple javascript function, but i am not sure if you have tried this already.  here is some code from a working app that i did a while ago which opens a small window for a list of values.  the user selects the value by clicking, which triggers this function.  this function assigns the value to a form field on the main page, then sets the focus back there and closes the small window.

<script language="JavaScript" type="text/JavaScript">
function pickClose(selRte) {
      self.opener.document.formCICM.txtChain.value = selRte
      self.opener.focus()
      window.close()
}
</script>
0
 

Author Comment

by:dklauk
ID: 18839669
It looks like what you have done is what I want to accomplish.  And, I did not include the 'self.opener' in the javascript I use.

However, when I use the 'self.opener.document.formname.pagediv.value = "<p>success.</p>" I get an error indicating that the 'self.opener.document.formname.pagediv.value' is null or not an object.



0
 
LVL 22

Expert Comment

by:WMIF
ID: 18839688
try doing 'self.opener.document.getElementById("nameOfDiv")' with correct letter case.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 63

Expert Comment

by:Zvonko
ID: 18839698
Because of reload of html content in popup asp B does the popup loose the reference to its opener.
To get back the reference to opener does the opener need to have a window name.
Therefore you need to set the name on asp A.
Like this:
<script>
window.name="aspWinA";
window.open("windowb.asp");
</script>

Now that winaow for asp a has a name you can change the div innerHTM on asp A like this:
<script>
function finishAndClose(){
  var winA = window.open("",="aspWinA","top=90000,left=90000");
  winA.document.getElementById("yourDivID").innerHTML = "Job done.";
  winA.focus();
  self.close();
}
</script>

0
 
LVL 63

Accepted Solution

by:
Zvonko earned 500 total points
ID: 18839708
Sorry, typo.
Take this:

<script>
function finishAndClose(){
  var winA = window.open("","aspWinA","top=90000,left=90000");
  winA.document.getElementById("yourDivID").innerHTML = "Job done.";
  winA.focus();
  self.close();
}
</script>


0
 

Author Comment

by:dklauk
ID: 18839995
Zvonko...

Your solution worked exactly as needed!  Thanks.
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 18841950
You are welcome.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now