我有一個簡單的輸入表單,輸入字段爲3個字符寬。然而,爲了獲得這些領域的重點,我必須點擊該領域的非常非常左側,大約1個像素或寬度的寬度。該表單在Firefox和Safari中運行良好,您可以在文本輸入字段中的任意位置單擊以獲得焦點。IE文本輸入字段「可點擊」區域只有1個像素寬
形式:
function player_list($gameID)
//////////////////////////////////////////////
// Creates player list for specified //
// game. Provides input for game results. //
//////////////////////////////////////////////
{
//*****Get list of players for gameID*****
$sql = "SELECT rsvpid,rsvp.playerid,concat(fname,' ',lname) as playerName,place,points,freeChamp FROM rsvp LEFT JOIN players ON rsvp.playerid=players.id WHERE rsvp.gameID=$gameID ORDER BY place,lname";
$playerlist = mysql_query($sql);
if ($listrow = mysql_fetch_array($playerlist))
{
#--Get number of players who signed up on the website. This may differ from the actual player count --#
#--entered by the host. A player may have played but not be signed up on the website. --#
echo "<input type=hidden name='recordedPlayerCount' value='".mysql_num_rows($playerlist)."'>";
$i = 0; // index for form rows
do
{
foreach($listrow as $key=>$value) $$key = $value;
($freeChamp) ? $freeChampChecked = "checked" : $freeChampChecked = ""; //check the freechamp box if appropriate.
if ($place==100) $place="";
?>
<tr>
<td><?=$playerName?>:</td>
<td style="text-align:center"><input type=text size="2" name="place<?=$i?>" value="<?=$place?>"></td>
<td style="text-align:center"><input type=checkbox name="freeChamp<?=$i?>" value='true' <?=$freeChampChecked?>></td>
<td style="text-align:center"><input type=checkbox name="noShow<?=$i?>" value='true'></td>
<input type=hidden name="rsvpid<?=$i?>" value="<?=$rsvpid?>">
</tr>
<?
$i++; //increment index for next row
}while ($listrow = mysql_fetch_array($playerlist));
}else
echo "<tr><td colspan='4'>NO RECORDS FOUND FOR THIS GAME!</td></tr>";
}
?>
違規的表單字段是 「地方」 現場......這是可點擊只在:
<form name=game_edit method=post action="?includepage=game_results.php&gameID=<?=$gameID?>" onsubmit="return validate_form();">
<table border="0" id=gameResults>
<tr><th colspan="4">RESULTS FOR: <?=$gamedate?> HOSTED BY <?=$hostName?></th></tr>
<tr>
<td colspan="2">PLAYERS: <input type=text name=playercount value="<?=$playercount?>" size="3"></td>
<td colspan="2">Championship money colleted: $<?=$champamount?></td>
</tr>
<tr><th>PLAYER</th><th>Place</th><th>Champ Discount</th><th>Didn't play</th></tr>
<? Player_list($gameID); ?>
<tr><td colspan="2"><input type="text" name="manualAdd" size="17" /></td><td colspan="2">Add a username who didn't RSVP</td></tr>
<input type=hidden name=gameID value="<?=$gameID?>">
<tr>
<td colspan="2"><input type=submit name='saveGameResults' value='SAVE CHANGES' style='width:100px;font-size:11px;'></td>
<td colspan="2" align="right"><input type=submit name='saveGameResults' value='LOCK GAME' style='width:100px;font-size:11px;'></td>
</tr>
</table>
寫入字段功能表單字段的左側,而不是整個表單字段,僅在IE中。 (IE 7,我知道的)。
幫助?
沒有喜歡maxlength.I甚至完全取消了大小限制器,所以寬度是默認的10個左右的字符寬度。仍然必須點擊左側的一個像素。 很好的捕捉函數名稱......有趣的是,函數仍然被調用。我認爲PHP對於這樣的事情是大小寫敏感的。 感謝提取的提示()...這比foreach()有點乾淨。 – Chris 2011-03-20 21:10:12
嗯。那肯定很奇怪。有沒有可能影響元素行爲的外部CSS或Javascript?通常,當我遇到這樣的障礙時,我會考慮是否在加價時做出最佳決定。嘗試桌子以外的東西會有意義嗎?如果您簡化了表單(即刪除除輸入元素之外的所有其他標記),它會正常工作嗎?有時如果事情簡化,有什麼問題會變得更加明顯。 – 2011-03-21 02:54:56
發表瞭解決方案...不知道IE是否只是一個問題。謝謝你的幫助。 – Chris 2011-03-21 14:49:56