删除帧并将内容加载到div中 [英] Remove frames and loading content into the div

查看:76
本文介绍了删除帧并将内容加载到div中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

反正我可以卸载已经加载到iframe中的页面吗?它可能会删除
窗口并从其他页面加载内容到 div



我正在使用iframe在我的主屏幕上调用一个文件 left_nav.php

 < ; iframe src ='left_nav.php'name ='left_nav'class =daemonscrolling =autoframeborder ='0'height ='100%'width =100%>< / iframe> 

left_nav 函数和方法中加载内容从 main_title.php



其他页面创建的函数 left_nav.php

  setEncounter(edate,eid,frname){
if(eid == active_encounter)返回;
if(!eid)edate ='<?php xl('None','e'); ?>;
var str ='< b>'+ edate +'< / b>';
setDivContent('current_encounter',str);
active_encounter = eid;
encounter_locked = isEncounterLocked(active_encounter);
reloadEncounter(frname);
syncRadios();
var encounter_block = $(parent.Title.document.getElementById('current_encounter_block'));
var encounter = $(parent.Title.document.getElementById('current_encounter'));
var estr ='< a href = \'javascript:; \'onclick =parent.left_nav.loadCurrentEncounterFromTitle()> < b>'+ edate +'('+ eid +')< / b>< / a>';
encounter.html(estr);
encounter_block.show();



函数loadCurrentEncounterFromTitle(){
top.restoreSession();
top.frames [parent.left_nav.getEncounterTargetFrame('enc')] .location ='.. / patient_file / encounter / encounter_top.php';



function getEncounterTargetFrame(name){
var bias =<?php echo $ primary_docs ['enc'] [1]?>;
var f = document.forms [0];
var r ='RTop';
if(f.cb_top.checked){
if(bias == 2){
r ='RTop';

}
}
return r;



$ b

这是 left_nav 加载loadFrame2

 函数loadFrame2(fname,frame,url){
var usage = fname。子(3);
if(active_pid == 0&& usage>'0'){
alert('<?php xl('您必须先选择或添加访问者','e' )?>');
返回false;

if(active_encounter == 0&& usage>'1'){
alert('<?php xl('您必须先选择或创建一个相遇。 ','e')→>');
返回false;

if(encounter_locked&& usage>'1'){
alert('<?php echo xls('This encounter locked。Add new forms can be added ''?>');
返回false;
}
var f = document.forms [0];
top.restoreSession();
var i = url.indexOf('{PID}');
if(i> = 0)url = url.substring(0,i)+ active_pid + url.substring(i + 5);
if(f.sel_frame){
var fi = f.sel_frame.selectedIndex;
if(fi == 1)frame ='RTop'; else if(fi == 2)frame ='RBot';
}
if(!f.cb_bot.checked)frame ='RTop';
top.frames [frame] .location ='<?php echo$ web_root / interface /?>'+ url;
if(frame =='RTop')topName = fname;
返回false;

main_title.php $ b $ pre $ $ $ $ $ $ $ $ $ $ $ $ document.getElementById('EncounterHistory')。selectedIndex = 0;
if(rawdata ==''){
return false;
} else if(rawdata =='New Encounter'){
top.window.parent.left_nav.loadFrame2('nen1','RBot','forms / newpatient / new.php?autoloaded = 1& calenc =')
返回true;
} else if(rawdata =='Past Encounter List'){
top.window.parent.left_nav.loadFrame2('pel1','RBot','patient_file / history / encounters.php')
返回true;
}
var parts = rawdata.split(〜);
var enc = parts [0];
var datestr = parts [1];
var f = top.window.parent.left_nav.document.forms [0];
frame ='RBot';
if(!f.cb_bot.checked){
frame ='RTop';
}

parent.left_nav.setEncounter(datestr,enc,frame);
top.frames [frame] .location.href ='../patient_file/encounter/encounter_top.php?set_encounter='+ enc;


解决方案

在最后一行代码在设置了新的iframe源代码的情况下,您使用的是href属性而不是src。由于iframe没有href属性,这可以解释结果的缺失。

  top.frames [frame] .src = '../patient_file/encounter/encounter_top.php?set_encounter='+ enc; 

尝试改变它并查看它是否有效。


Is there anyway i can unload a page that has been loaded inside an iframe? it likely removing the windows and loading content from other pages into the div?

I am using iframe on my main screen to call a file left_nav.php

<iframe src='left_nav.php' name='left_nav' class="daemon" scrolling="auto" frameborder='0' height='100%' width="100%"></iframe>

In left_nav functions and methods to load content from other pages like main_title.php

Function created in left_nav.php file below

setEncounter(edate, eid, frname) {
  if (eid == active_encounter) return;
  if (!eid) edate = '<?php xl('None','e'); ?>';
  var str = '<b>' + edate + '</b>';
  setDivContent('current_encounter', str);
  active_encounter = eid;
  encounter_locked=isEncounterLocked(active_encounter);
  reloadEncounter(frname);
  syncRadios();
  var encounter_block = $(parent.Title.document.getElementById('current_encounter_block'));
  var encounter = $(parent.Title.document.getElementById('current_encounter'));
  var estr = '<a href=\'javascript:;\' onclick="parent.left_nav.loadCurrentEncounterFromTitle()">       <b>' + edate + ' (' + eid + ')</b></a>';
  encounter.html( estr );
  encounter_block.show();
}


function loadCurrentEncounterFromTitle() {
  top.restoreSession();
  top.frames[ parent.left_nav.getEncounterTargetFrame('enc')     ].location='../patient_file/encounter/encounter_top.php';
}


function getEncounterTargetFrame( name ) {
  var bias = <?php echo $primary_docs[ 'enc'  ][ 1 ]?>;
  var f = document.forms[0];
  var r = 'RTop';
  if (f.cb_top.checked) {
    if ( bias == 2 ) {
        r = 'RTop';

    }
  }
  return r;
}

This is a js script in left_nav to load loadFrame2

function loadFrame2(fname, frame, url) {
  var usage = fname.substring(3);
  if (active_pid == 0 && usage > '0') {
    alert('<?php xl('You must first select or add a visitor.','e') ?>');
    return false;
  }
  if (active_encounter == 0 && usage > '1') {
    alert('<?php xl('You must first select or create an encounter.','e') ?>');
    return false;
  }
  if (encounter_locked && usage > '1') {
    alert('<?php echo xls('This encounter is locked. No new forms can be added.') ?>');
    return false;
  }
  var f = document.forms[0];
  top.restoreSession();
  var i = url.indexOf('{PID}');
  if (i >= 0) url = url.substring(0,i) + active_pid + url.substring(i+5);
  if(f.sel_frame) {
    var fi = f.sel_frame.selectedIndex;
    if (fi == 1) frame = 'RTop'; else if (fi == 2) frame = 'RBot';
  }
  if (!f.cb_bot.checked) frame = 'RTop';
  top.frames[frame].location = '<?php echo "$web_root/interface/" ?>' + url;
  if (frame == 'RTop') topName = fname;
  return false;
}

Funtions created in main_title.php file.

function toencounter(rawdata) {
  document.getElementById('EncounterHistory').selectedIndex=0;
  if(rawdata=='') {
    return false;
  } else if (rawdata=='New Encounter') {
    top.window.parent.left_nav.loadFrame2('nen1','RBot','forms/newpatient/new.php?   autoloaded=1&calenc=')
    return true;
  } else if (rawdata=='Past Encounter List') {
    top.window.parent.left_nav.loadFrame2('pel1','RBot','patient_file/history/encounters.php')
    return true;
  }
  var parts = rawdata.split("~");
  var enc = parts[0];
  var datestr = parts[1];
  var f = top.window.parent.left_nav.document.forms[0];
  frame = 'RBot';
  if (!f.cb_bot.checked) {
    frame = 'RTop';
  }

  parent.left_nav.setEncounter(datestr, enc, frame);
  top.frames[frame].location.href  = '../patient_file/encounter/encounter_top.php?set_encounter=' +     enc;
}

解决方案

In the last line of code where the new iframe source is set, you're using the href attribute instead of the src. Since iframe does not have an href attribute, that would explain the lack of results.

top.frames[frame].src  = '../patient_file/encounter/encounter_top.php?set_encounter=' +     enc;

Try changing to that and see if it works.

这篇关于删除帧并将内容加载到div中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆