Solved

asp to asp semaphores

Posted on 2007-04-02
7
335 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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
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…

830 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