Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reload parent window from iframe 1

Status
Not open for further replies.

j4ckl3

IS-IT--Management
Apr 30, 2002
33
0
0
US
I am currently taking over working on our corporate intranet from an employee that has left our company. We have a page that allows us to manipulate files (move, delete, download) based on action selected. However when the index.php page loads I am receiving a javascript error that I cannot pinpoint the problem.

The line error is highlighted in [red]red[/red] below:

Code:
<script language="javascript" src="include/progress.js"></script>
<script language='JavaScript'> 
  var farr = new Array(); 
  var darr = new Array();
  var dest = ''; 
				
  function fchecked(){
    var numfiles = document.forms['checkedfiles'].elements.length-1; var i; 
    var c=0; 
    for(i=0;i<numfiles;i++){ 
      if(document.forms['checkedfiles'].elements[i].checked){ 
        var val = document.forms['checkedfiles'].elements[i].value; 
        var val2 = document.forms['checkedfiles'].elements[i].id;
        farr[c]=val;
        darr[c]=val2;
        c++; 
      } 
    } 
  }

  function picked(sel){ 
    var choice = sel.selectedIndex; 
    dest = sel.options[choice].value; 
  } 

  var c=0;
  var actfailed = 0; 

  function perform(act){ 
    fchecked(); 
    if(farr.length !== 0) { 
      progressBarInit(); 
      var i; 
      for(i=0;i<farr.length;i++){ 
        if(act == 'movefile'){ 
	      if(dest !== ''){    
            actfailed = 0; 
            urlString = 'index.php?action='+act+'&filename='+farr[i]+'&directory='+darr[i]+'&new_dir='+dest+'&';
            processAct(urlString); 
          } else {
            actfailed = 1; 
            alert('please pick a target');
            break;
          }
        } else {
          actfailed = 0; 
          urlString = 'index.php?action='+act+'&filename='+farr[i]+'&directory='+darr[i]+'&';
          processAct(urlString);
        }
      }
      if(actfailed !== 1) window.status = 'Please wait...';
    } else { 
      alert('You need to select a file in order to perform an action. Note: If you are in a top-level directory then click on a directory that contains files.'); 
    } 
  } 

  function processAct(url){ 
    document.getElementById('popContainer').innerHTML += '<iframe width=\'200\' height=\'200\' src=\''+ url +'\'></iframe>';
  } 
    
  function refreshPage(rdir){
    window.location = 'index.php?&none&directory='+rdir+'&';
  } 

  function notify(){ 
    var delay = '1000'; 
    c++; 
    if(c == farr.length) window.setTimeout("refreshPage('"+darr[0]+"')", delay); 
  } 

  [red][b]window.onload = window.parent.notify();[/b][/red] 
</script>

------------------------------------------------------------------------------
nobody knows everything about IT, so make a point to help your fellow members

-= j@ckle =-
 
Try changing that line to:
Code:
window.onload = refreshParent;

function refreshParent() {
   window.parent.notify();
}
 
You are awesome!!

You have no idea how long I was trying to figure that out! It worked like a charm.

Kudos to you...

----------------------------
-= j@ckle =-


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top