Solved

asp to asp semaphores

Posted on 2007-04-02
7
328 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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
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…

746 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

9 Experts available now in Live!

Get 1:1 Help Now