【问题标题】:open path files to different iframes打开不同 iframe 的路径文件
【发布时间】:2016-03-14 12:18:48
【问题描述】:
<?php 

// directory path can be either absolute or relative 
$dirPath = "C:/xampp/htdocs/statistics/pdf/"; 

// open the specified directory and check if it's opened successfully 
if ($handle = opendir($dirPath)) { 

   // keep reading the directory entries 'til the end 
   $i=0; 
   while (false !== ($file = readdir($handle))) { 
   $i++; 

      // just skip the reference to current and parent directory 
      if (eregi("\.pdf",$file)){ 
         if (is_dir("$dirPath/$file")) { 
            // found a directory, do something with it? 
            echo "<a href='$dirPath/$file' ><font color='black' link='black' vlink='black' > $file  </font></a><br>"; 
         } else { 
            // found an ordinary file 
            echo "<a href='$dirPath/$file' ><font color='black' link='black' vlink='black' >$i . $file  </font></a><br>"; 
         } 
      } 
   } 
   // ALWAYS remember to close what you opened 
   closedir($handle); 
}  
?>
<iframe src="xxx" width="100%" height="800"style="border: none;"></iframe>

我想将我的目录中的每个不同文件打开到 iframe div 中,以隐藏以前的文件并显示按下的链接。这些文件我从我的路径打开它,我想要一个包含这些文件的列表并在 iframe 中打开它。

【问题讨论】:

  • 那么实际的问题是什么?欢迎来到SO,请访问help center查看如何提问
  • 我有打开 div 的代码(到链接列表),我的列表有 100 个文件,我想在不同的 iframe 中打开它(我有 iframe 的代码)但我不知道如何从 php 中将其打开到一个 div 并替换另一个

标签: javascript php html css iframe


【解决方案1】:

您想定位 iFrame?

if (is_dir("$dirPath/$file")) { 
  // found a directory, do something with it? 
  echo "<a href='$dirPath/$file' target='iframe1'><font color='black' link='black' vlink='black' > $file  </font></a><br>"; 
} else { 
  // found an ordinary file 
  echo "<a href='$dirPath/$file' target='iframe2'><font color='black' link='black' vlink='black' >$i . $file  </font></a><br>"; 
} 

使用

<iframe name="iframe1" src="about:blank" width="100%" height="800"style="border: none;"></iframe>
<iframe name="iframe2" src="about:blank" width="100%" height="800"style="border: none;"></iframe>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-15
    • 2021-12-31
    相关资源
    最近更新 更多