Jump to content

make text align


phpfreaks member

Recommended Posts

2eklquf.png

 

as u can see "dev" is out of alignment, how do i make it align to "ext", "extras", "PEAR"?

 

here is my php script which makes a dir tree

 

<?
if($_GET[dir])
{

if($_GET[dir]=='root')
{
   for ($i = 67; $i <= 90; $i++)
       if (is_dir(chr($i).':'))
           echo chr($i).":\n";
}
else
{
if ($handle = opendir($_GET[dir])) {
chdir($_GET[dir]);
   while (false !== ($file = readdir($handle)))
       if ($file != "." && $file != "..")
       if(is_dir($file)==true)
           echo "$file\n";
   closedir($handle);
}
}
}
else
{
?>

<html>
<style type="text/css">
.node {
font-family: Lucida Console;
font-size: 12px;
margin-left: 2em;
}

.expand {

text-align: center;
font-family: Lucida Console;
font-size: 12px;
//	font-weight: 400;
}

</style>

<script type="text/javascript">
function expandTree(parent, isRoot)
{
if(parent.innerHTML=='+')
{
var xmlobj = new XMLHttpRequest();
xmlobj.open('GET','/?dir='+escape(parent.parentNode.parentNode.id),false)
xmlobj.send(null);
var subDir = xmlobj.responseText.split('\n');
if(subDir.length==1)
	alert(parent.parentNode.innerHTML=null);
for(var i=0;i<subDir.length-1;i++)
{
	var childDiv = document.createElement('div');
	if(isRoot)
	childDiv.setAttribute('id', subDir[i]+'/');
	else
	childDiv.setAttribute('id', parent.parentNode.parentNode.id+subDir[i]+'/');
	childDiv.setAttribute('class', 'node');
	childDiv.innerHTML =  '<span class="expand">[<a href="javascript:void(0);" onclick="expandTree(this,false);">+</a>]</span> <span id="folder">'+subDir[i]+'</span><br/>';
	parent.parentNode.parentNode.appendChild(childDiv);
}
parent.innerHTML = '-';
}
else
{

var e=parent.parentNode.parentNode.getElementsByTagName('div');
while(e.length)
parent.parentNode.parentNode.removeChild(e[0]);

parent.innerHTML = '+';
}

}


</script>

<body>
<div id="root" class="node"><span class="expand">[<a href="javascript:void(0);" onclick="expandTree(this,true);">+</a>]</span> My Computer</div>
</body>
</html>

<?
}
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.