上一頁 網頁地址

September 16th, 2010

Javascript

<INPUT TYPE=”button” VALUE=”上一頁  ” onClick=”history.go(-1)”>
<INPUT TYPE=”button” VALUE=”下一頁” onCLick=”history.go(1)”>

PHP

$_SERVER[HTTP_REFERER] //可以得到上一頁的地址
$_SERVER[PHP_SELF] //得到當前頁面地址

$_SERVER[‘HTTP_HOST’].$_SERVER[‘REQUEST_URI’]

$_SERVER[HTTP_HOST].$_SERVER[PHP_SELF].”?”.$_SERVER[QUERY_STRING]

如果網頁做左一些action(例如: update資料, 之後回到同一頁), 有一些browers按一次還是同一頁, 要第2下才會回到上一頁, 我的解決:

$pos = strpos($_SERVER[‘HTTP_REFERER’], $_SERVER[“PHP_SELF”]);

if($pos === FALSE)
{
setcookie(‘back_href’, $_SERVER[‘HTTP_REFERER’]);
}

if($_COOKIE[‘back_href’])
$back_href = $_COOKIE[back_href];
else
$back_href = $_SERVER[HTTP_REFERER];

if($back_href)
{
echo ‘<a href=”‘.$back_href.'”>Back</a>’;
}

HTML, Javascript, PHP, Program ,

IE bug – Colspan Bug in IE

August 28th, 2010

<table border=”1″ width=”100%”>
<tr>
<th align=”center” width=”1″><input type=”checkbox” value=”2″ /></th>
<th>Name 1</th>
<th>Name 2</th>
<th>Name 3</th>
</tr>
<tr>
<td colspan=”4″>
<input type=”button” name=”it is button 1″ value=”it is button Submit 1″ />
<input type=”button” name=”it is button 2″ value=”it is button Submit 2″ />
</td>
</tr>
</table>

My Solution :

<table border=”1″ width=”100%”>
<tr>
<th align=”center” width=”1″><input type=”checkbox” value=”2″ /></th>
<th>Name 1</th>
<th>Name 2</th>
<th>Name 3</th>
</tr>
<tr>
<td colspan=”4″ style=”width:auto;”>
<input type=”button” name=”it is button 1″ value=”it is button Submit 1″ />
<input type=”button” name=”it is button 2″ value=”it is button Submit 2″ />
</td>
</tr>
</table>

CSS, HTML

HTML disable input text history

August 7th, 2010

主要防止一些javascript執行(onchange, onclick)的時候,沒有回應
<input type=”text” autocomplete off />
這樣就能取消text box history

HTML , ,