IE文本输入字段“可点击”区域仅为1像素宽

时间:2011-03-20 16:47:17

标签: php internet-explorer forms

我有一个简单的输入表单,输入字段宽3个字符。然而,为了获得对这些领域的关注,我必须单击该字段的非常非常左边,大约1个像素或光标宽度宽。该表单在Firefox和Safari中运行良好,您可以在文本输入字段中的任意位置单击以获得焦点。

表格:

<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>

写入字段的函数:

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>";
}
?>

违规表单字段是“地点”字段...它只能在表单字段的最左侧而不是整个表单字段中单击,仅在IE中。 (IE 7,我知道)。

帮助?

2 个答案:

答案 0 :(得分:0)

我愿意打赌,罪魁祸首是将输入元素的大小设置为2.给它一个镜头,让我知道它是否有效:

<td style="text-align:center"><input type=text size="3" maxlength="2" name="place<?=$i?>" value="<?=$place?>"></td>

我的代码中还有其他一些注意事项:

<tr><th>PLAYER</th><th>Place</th><th>Champ
Discount</th><th>Didn't play</th></tr>
<? Player_list($gameID); ?>

您调用函数“Player_list()”,但您的函数名为“player_list()”。

foreach($listrow as $key=>$value) $$key = $value;

与:

相同
extract($listrow);

答案 1 :(得分:0)

谢谢你的提示,迈克尔。发现了这个问题。我在一个标题div中有一个css驱动的水平下拉菜单(http://www.udm4.com/),它在内容div上下降。在此之上,我有一个javascript驱动的登录面板,可以通过标题div下拉。在使用z-index以便一切都很好玩的时候,我将保存表单的内容div设置为z-index为-1。即使在取出除了一个div和一个表单之外的所有内容之后,IE也不喜欢负z索引。我不知道负的z索引是否构成有效的CSS,而IE又是一个小问题,或者其他浏览器是否过于宽松。