Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/411.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 打开指向不同iFrame的路径文件_Javascript_Php_Html_Css_Iframe - Fatal编程技术网

Javascript 打开指向不同iFrame的路径文件

Javascript 打开指向不同iFrame的路径文件,javascript,php,html,css,iframe,Javascript,Php,Html,Css,Iframe,我想将每个不同的文件从我的dir打开到iframe div,以隐藏上一个文件并显示按下的链接。这些文件我从路径打开它,我希望有一个包含这些文件的列表,并在iframe中打开它。您想以iframe为目标吗 <?php // directory path can be either absolute or relative $dirPath = "C:/xampp/htdocs/statistics/pdf/"; // open the specified directory and

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

您想以iframe为目标吗

<?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>
if(is_dir(“$dirPath/$file”){
//找到一个目录,用它做些什么?
回声“
”; }否则{ //找到一个普通的文件 回声“
”; }
使用

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>"; 
} 


那么实际问题是什么?欢迎来到SO,请访问查看如何aski有代码来打开我的div(链接列表),我的列表有100个文件,我想在不同的iframe中打开它(我有iframe的代码),但我不知道如何从php中打开它到一个div并替换另一个
<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>