Solved

asp to asp semaphores

Posted on 2007-04-02
7
338 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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…

623 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