Re: [請益] 數字對齊
※ 引述《noguchi (耶?!)》之銘言:
我現在要產生12列4欄的文字方塊
前面會有編號
當變兩位數時文字方塊會跟著往後退一格
但我想讓他數字後一位對齊
1. 文字方塊 1. 文字方塊
2. 文字方塊 2. 文字方塊
. => 變 .
. .
. .
10. 文字方塊 10. 文字方塊
以下是程式碼..我可以怎麼改呢??
<? $n=12;
for ($i=1; $i<=$n; $i++)
{
echo " <font face='Courier New, Courier, mono'>";
echo str_replace(" "," ",sprintf("%4d",$i));
//4是看你要格式化幾位數
echo "</font>.
<input type=\"text\" name=\"sid[$i]\">
<input type=\"text\" name=\"name[$i]\">
<input type=\"text\" name=\"phone[$i]\">
<input type=\"text\" name=\"email[$i]\"><br>
";
}
?>
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 203.64.183.208
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.42.176
※ 編輯: cfw 來自: 140.112.42.176 (08/18 11:24)
→
08/18 12:09, , 1F
08/18 12:09, 1F
推
08/19 12:15, , 2F
08/19 12:15, 2F
討論串 (同標題文章)
PHP 近期熱門文章
PTT數位生活區 即時熱門文章