Javascript 打开指向不同iFrame的路径文件
我想将每个不同的文件从我的dir打开到iframe div,以隐藏上一个文件并显示按下的链接。这些文件我从路径打开它,我希望有一个包含这些文件的列表,并在iframe中打开它。您想以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
<?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>