无法在浏览器调整大小时选择文本框

时间:2014-12-23 13:30:13

标签: css browser

我有一个网页表单网站,随机某些行或单个文本框将被禁止选择以获得焦点。光标永远不会从文本框边界处的箭头变为文本管道。有时,从指针到文本管道的更改将发生在文本框的中间。如果我调整浏览窗口的大小,我可以改变这种行为。通常运行browswer最大化使得它消失。我已经搜索了这个,我在SO上找不到类似内容,或者我使用了错误的搜索字词。

Web Form Example http://uber-writer.com/wp-content/uploads/2014/12/SchCIncomeForm.png

图像显示了一个包含一些假设数据的典型表格。 "摊销Exp"行导致问题。下面显示的是表格标记:

<table class="incomeDataEntryTblNarrow_wTotal">
    <tr>
        <td>
            Tax Year:
        </td>
        <td>
            <asp:TextBox ID="txtSchedC_oneYearAgoYear" Text='<%# Eval("oneYearAgoYear") %>' runat="server" Width="40px"></asp:TextBox>
        </td>
        <td>
            <asp:Label ID="lblSchedC_prevYear" runat="server" Text="INVLD" Font-Size="10"></asp:Label>
        </td>
    </tr>
    <tr>
        <td>
            W2 Line 5:
        </td>
        <td>
            <asp:TextBox ID="txtSchedC_w2box5_OneYearAgo" Text='<%# string.Format("{0:C}",Eval("w2box5_OneYearAgo")) %>' runat="server"  CssClass="incomeTextBox" ></asp:TextBox>
        </td>
        <td>
            <asp:TextBox ID="txtSchedC_w2box5_TwoYearsAgo" Text='<%# string.Format("{0:C}",Eval("w2box5_TwoYearsAgo")) %>' runat="server"  CssClass="incomeTextBox"  ></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td>
            Line 6<br />Other Income:
        </td>
        <td>
            <asp:TextBox ID="txtSchedC_Line6_OneYearAgo" Text='<%# string.Format("{0:C}",Eval("line6_OneYearAgo")) %>' runat="server"  CssClass="incomeTextBox" onkeydown="return jsDecimalsRO(event);" ></asp:TextBox>
        </td>
        <td>
            <asp:TextBox ID="txtSchedC_Line6_TwoYearsAgo" Text='<%# string.Format("{0:C}",Eval("line6_TwoYearsAgo")) %>' runat="server"  CssClass="incomeTextBox"  onkeydown="return jsDecimalsRO(event);" ></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td>
            Line 12<br />Depletion:
        </td>
        <td>
            <asp:TextBox ID="txtSchedC_Line12_OneYearAgo" Text='<%# string.Format("{0:C}",Eval("line12_OneYearAgo")) %>' runat="server"  CssClass="incomeTextBox" ></asp:TextBox>
        </td>
        <td>
            <asp:TextBox ID="txtSchedC_Line12_TwoYearsAgo" Text='<%# string.Format("{0:C}",Eval("line12_TwoYearsAgo")) %>' runat="server"  CssClass="incomeTextBox" ></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td>
            Line 13<br />Depreciation:
        </td>
        <td>
            <asp:TextBox ID="txtSchedC_Line13_OneYearAgo" Text='<%# string.Format("{0:C}",Eval("line13_OneYearAgo")) %>' runat="server"  CssClass="incomeTextBox" ></asp:TextBox>
        </td>
        <td>
            <asp:TextBox ID="txtSchedC_Line13_TwoYearsAgo" Text='<%# string.Format("{0:C}",Eval("line13_TwoYearsAgo")) %>' runat="server"  CssClass="incomeTextBox" ></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td>
            Line 24b<br />Meals & Entertainment:
        </td>
        <td>
            <asp:TextBox ID="txtSchedC_Line24b_OneYearAgo" Text='<%# string.Format("{0:C}",Eval("line24b_OneYearAgo")) %>' runat="server"  CssClass="incomeTextBox" ></asp:TextBox>
        </td>
        <td>
            <asp:TextBox ID="txtSchedC_Line24b_TwoYearsAgo" Text='<%# string.Format("{0:C}",Eval("line24b_TwoYearsAgo")) %>' runat="server"  CssClass="incomeTextBox" ></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td>
            Line 30<br />Expenses Home Use:
        </td>
        <td>
            <asp:TextBox ID="txtSchedC_Line30_OneYearAgo" Text='<%# string.Format("{0:C}",Eval("line30_OneYearAgo")) %>' runat="server"  CssClass="incomeTextBox" ></asp:TextBox>
        </td>
        <td>
            <asp:TextBox ID="txtSchedC_Line30_TwoYearsAgo" Text='<%# string.Format("{0:C}",Eval("line30_TwoYearsAgo")) %>' runat="server"  CssClass="incomeTextBox" ></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td>
            Line 31<br />Net Profit:
        </td>
        <td>
            <asp:TextBox ID="txtSchedC_Line31_OneYearAgo" Text='<%# string.Format("{0:C}",Eval("line31_OneYearAgo")) %>' runat="server" CssClass="incomeTextBox" ></asp:TextBox>
        </td>
        <td>
            <asp:TextBox ID="txtSchedC_Line31_TwoYearsAgo" Text='<%# string.Format("{0:C}",Eval("line31_TwoYearsAgo")) %>' runat="server"  CssClass="incomeTextBox" ></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td>
            Amortization Exp<br />Part V:
        </td>
        <td>
            <asp:TextBox ID="txtSchedC_Amort_OneYearAgo" Text='<%# string.Format("{0:C}",Eval("Amortization_OneYearAgo")) %>' runat="server" CssClass="incomeTextBox" ></asp:TextBox>
        </td>
        <td>
            <asp:TextBox ID="txtSchedC_Amort_TwoYearsAgo" Text='<%# string.Format("{0:C}",Eval("Amortization_TwoYearsAgo")) %>' runat="server"  CssClass="incomeTextBox" ></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td>
            Casualty Loss<br />Part V:
        </td>
        <td>
            <asp:TextBox ID="txtSchedC_Casualty_OneYearAgo" Text='<%# string.Format("{0:C}",Eval("Casualty_OneYearAgo")) %>' runat="server" CssClass="incomeTextBox" ></asp:TextBox>
        </td>
        <td>
            <asp:TextBox ID="txtSchedC_Casualty_TwoYearsAgo" Text='<%# string.Format("{0:C}",Eval("Casualty_TwoYearsAgo")) %>' runat="server"  CssClass="incomeTextBox" ></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td>
            Other Exp<br />Part V:
        </td>
        <td>
            <asp:TextBox ID="txtSchedC_Other_OneYearAgo" Text='<%# string.Format("{0:C}",Eval("OtherExp_OneYearAgo")) %>' runat="server" CssClass="incomeTextBox" ></asp:TextBox>
        </td>
        <td>
            <asp:TextBox ID="txtSchedC_Other_TwoYearsAgo" Text='<%# string.Format("{0:C}",Eval("OtherExp_TwoYearsAgo")) %>' runat="server"  CssClass="incomeTextBox" ></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td>
            Business Miles<br />Part IV Linve44a:
        </td>
        <td>
            <asp:TextBox ID="txtSchedC_BizMiles_OneYearAgo" Text='<%# Eval("BizMiles_OneYearAgo") %>' runat="server" CssClass="incomeTextBox" ></asp:TextBox>
        </td>
        <td>
            <asp:TextBox ID="txtSchedC_BizMiles_TwoYearsAgo" Text='<%# Eval("BizMiles_TwoYearsAgo") %>' runat="server"  CssClass="incomeTextBox" ></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td>
            Total Income:
        </td>
        <td>
            <asp:Label ID="lblFinalIncomeY1" Text='<%# string.Format("{0:C}",Eval("finalIncomeY1")) %>' runat="server" Font-Size="12px"  width="75" style="text-align:right;"></asp:Label>
        </td>
        <td>
            <asp:Label ID="lblFinalIncomeY2" Text='<%# string.Format("{0:C}",Eval("finalIncomeY2")) %>' runat="server" Font-Size="12px"  width="75" style="text-align:right;"></asp:Label>
        </td>
    </tr>
</table>

文本框的CSS在这里

.incomeTextBox {
    width: 85px;
    text-align: right;
    cursor: text;
    z-index: 999;
}

我删除了空白并尝试了网站并得到了同样的响应。

<table class="incomeDataEntryTblNarrow_wTotal">
<tr>
    <td>Tax Year:</td>
    <td><asp:TextBox ID="txtSchedC_oneYearAgoYear" Text='<%# Eval("oneYearAgoYear") %>' runat="server" Width="40px"></asp:TextBox></td>
    <td><asp:Label ID="lblSchedC_prevYear" runat="server" Text="INVLD" Font-Size="10"></asp:Label></td>
</tr>
<tr>
    <td>W2 Line 5:</td>
    <td><asp:TextBox ID="txtSchedC_w2box5_OneYearAgo" Text='<%# string.Format("{0:C}",Eval("w2box5_OneYearAgo")) %>' runat="server"  CssClass="incomeTextBox" ></asp:TextBox></td>
    <td><asp:TextBox ID="txtSchedC_w2box5_TwoYearsAgo" Text='<%# string.Format("{0:C}",Eval("w2box5_TwoYearsAgo")) %>' runat="server"  CssClass="incomeTextBox"  ></asp:TextBox></td>
</tr>
<tr>
    <td>Line 6<br />Other Income:</td>
    <td><asp:TextBox ID="txtSchedC_Line6_OneYearAgo" Text='<%# string.Format("{0:C}",Eval("line6_OneYearAgo")) %>' runat="server"  CssClass="incomeTextBox" onkeydown="return jsDecimalsRO(event);" ></asp:TextBox></td>
    <td><asp:TextBox ID="txtSchedC_Line6_TwoYearsAgo" Text='<%# string.Format("{0:C}",Eval("line6_TwoYearsAgo")) %>' runat="server"  CssClass="incomeTextBox"  onkeydown="return jsDecimalsRO(event);" ></asp:TextBox></td>
</tr>

2 个答案:

答案 0 :(得分:0)

您可以通过修复表格宽度来解决此重叠问题 比如说

table
{
width:600px;
}

它将修复调整浏览器大小的重叠问题 但你需要向右滚动才能看到其余的数据

答案 1 :(得分:0)

最终答案最终成为UpdateProgress消息框周围的包装div。

<%--        <div class="processingStatus">--%>
        <asp:UpdateProgress ID="UpdateProgress1" runat="server">
            <ProgressTemplate>
                <div class="processingMessage processingStatus">
                    Updating...
                </div>
            </ProgressTemplate>
        </asp:UpdateProgress>
<%--        </div>  --%>

在我已经注释掉包装div的片段中。包装器div的.css实际上是创建一个透明的div,可以阻止它背后的任何东西。这解释了为什么问题看起来是随机的,并且会在屏幕重新调整大小时发生变化。 UpdateProgress上的样式将消息置于屏幕中心,但屏幕上的内容不居中。我最终杀死了包装器div并将css类移动到ProgressTemplate内的div。部署了更改,它现在按预期工作。