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
https://forums.phpfreaks.com/topic/40891-make-text-align/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.