Php jquery目录树
我正在使用jquery列出目录,我想在其中输入delete复选框,并删除树上每个目录的submit buton。怎么做? 我正在使用下面的代码Php jquery目录树,php,jquery,Php,Jquery,我正在使用jquery列出目录,我想在其中输入delete复选框,并删除树上每个目录的submit buton。怎么做? 我正在使用下面的代码 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" dir
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>jQuery Drop Down Menu</title>
<!-- CSS For The Menu -->
<link rel="stylesheet" href="stylee.css" />
</head>
<body>
<!-- Menu Start -->
<div id="jQ-menu">
<?php
error_reporting(0);
$path = "store/".$diro."/";
function createDir($path = '.')
{
if ($handle = opendir($path))
{
echo "<ul>";
while (false !== ($file = readdir($handle)))
{
if (is_dir($path.$file) && $file != '.' && $file !='..')
printSubDir($file, $path, $queue);
else if ($file != '.' && $file !='..')
$queue[] = $file;
}
printQueue($queue, $path);
echo "</ul>";
}
}
function printQueue($queue, $path)
{
foreach ($queue as $file)
{
printFile($file, $path);
}
}
function printFile($file, $path)
{
echo "<li><a href=\"".$path.$file."\">$file</a></li>";
}
function printSubDir($dir, $path)
{
echo "<li><span class=\"toggle\">$dir</span>";
createDir($path.$dir."/");
echo "</li>";
}
createDir($path);
?>
</div>
<!-- End Menu -->
<!-- Add jQuery From the Google AJAX Libraries -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<!-- jQuery Color Plugin -->
<script type="text/javascript" src="jquery.color.js"></script>
<!-- Import The jQuery Script -->
<script type="text/javascript" src="jMenu.js"></script>
</body>
</html>
jQuery下拉菜单
您希望用户能够对该树做什么,以及它应该如何反应?凭直觉,我认为你至少可以走两条路。您可以直接输出复选框和按钮的html,然后使用选择器向它们添加行为,或者可以先输出树,然后在文档之后输出。准备好使用jquery的dom修改,例如before()来修改dom
根据您想要的功能,它可以是:
function printFile($file, $path)
{
echo "<li class='fileNode'><a href=\"".$path.$file."\">$file</a></li>";
}
function printSubDir($dir, $path)
{
echo "<li class='dirNode'><span class=\"toggle\">$dir</span>";
createDir($path.$dir."/");
echo "</li>";
}
函数printFile($file,$path)
{
回显“”;
}
函数printSubDir($dir,$path)
{
回显“$dir”;
createDir($path.$dir.“/”);
回声“ ”;
}
然后在JavaScript中执行如下操作
$(document).ready(function
{
// you should still assign some behaviour probably
$(".fileNode").prepend("<input type='checkbox' />");
});
$(文档).ready(函数)
{
//你仍然应该指定一些行为
$(“.fileNode”).prepend(“”);
});
或者,您可以确保复选框已经存在,并且可以将一些ajax函数绑定到复选框“change() 您希望用户能够对该树做什么,它应该如何反应?凭直觉,我认为你至少可以走两条路。您可以直接输出复选框和按钮的html,然后使用选择器向它们添加行为,或者可以先输出树,然后在文档之后输出。准备好使用jquery的dom修改,例如before()来修改dom 根据您想要的功能,它可以是:
function printFile($file, $path)
{
echo "<li class='fileNode'><a href=\"".$path.$file."\">$file</a></li>";
}
function printSubDir($dir, $path)
{
echo "<li class='dirNode'><span class=\"toggle\">$dir</span>";
createDir($path.$dir."/");
echo "</li>";
}
函数printFile($file,$path)
{
回显“”;
}
函数printSubDir($dir,$path)
{
回显“$dir”;
createDir($path.$dir.“/”);
回声“ ”;
}
然后在JavaScript中执行如下操作
$(document).ready(function
{
// you should still assign some behaviour probably
$(".fileNode").prepend("<input type='checkbox' />");
});
$(文档).ready(函数)
{
//你仍然应该指定一些行为
$(“.fileNode”).prepend(“”);
});
或者,您可以确保复选框已经存在,并且可以将一些ajax函数绑定到复选框“change() 检查这个
它很容易使用检查这个
它很容易使用你能提供一个链接到一个示例,我们可以看到这个树菜单在运行吗?你能提供一个链接到一个示例,我们可以看到这个树菜单在运行吗?好的,我希望用户可以从他的目录树中删除文件,这是该用户的uniq…Sou我不再使用这个代码了…我正在使用此网站中的此代码是由于目录树上的删除功能导致的,但该代码存在问题…请查看使用定义功能解决问题的我的问题…首先查看网站中的目录树,然后查看我的问题。。。如果你能帮忙,请联系mee…好的,我希望该用户可以从他的目录树中删除文件,这对该用户来说是唯一的…Sou我不再为此使用此代码…我使用此网站上的此代码,因为目录树上的所有删除功能都存在问题…查看我的使用DEFINE函数解决问题…首先查看网站上的目录树,然后查看我的问题。。。如果你能帮忙,请联系我。。。