HTML问题?滚动条不会通过window.open显示

时间:2009-07-05 00:09:07

标签: asp.net javascript html vb.net

我有一个VB.NET Web应用程序,当用户点击链接查看一些外部表格数据时,我打开一个窗口。我正在显示的数据肯定需要一个垂直滚动条才能看到所有内容...出于某种原因,我无法在新窗口加载时显示一个垂直滚动条。

这是打开窗口的JS:

function showDataTable(id, type) {
var pageUrl = "queries/ReportData.aspx";   
windowHandle = window.open(pageUrl, "FarmQuery", 'resizable=yes,scrollbars=yes');
windowHandle.focus();
}

正在打开的窗口的相应Page_Load方法:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Dim db As New UtilDb
    Dim errMsg As String = ""

    If (Not Page.IsPostBack) Then
        db.OpenGeoDb(MyGlobals.GeodataServiceName, errMsg)
        LoadFarmInfo(db, errMsg)
        LoadQueryData(db, errMsg)
        db.CloseGeoDb()
    End If
End Sub

为了我的价值,我补充说     style =“overflow:scroll;” 到包含数据表的div。

在构建“页面”的其余部分之后,数据表几乎就像呈现一样。有什么建议吗?

修改

问题出现在Firefox和IE中。我将JS中的window parameters参数从'resizable = yes,scrollbars = yes'修改为'resizable = yes,scrollbars = yes,toolbar = yes'并且确实显示了工具栏以显示这些选项是“正常工作”。

不幸的是我无法发布HTML。

修改

以下是HTML示例

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>
    Farm Query
</title><link href="../Default.css" type="text/css" rel="stylesheet" /><link     href="ReportData.css" type="text/css" rel="stylesheet" /></head>
<body>
    <form name="form1" method="post" action="ReportData.aspx?wfpId=DES-046&amp;type=1" id="form1">
<div>
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="#" />
</div>

<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['form1'];
if (!theForm) {
    theForm = document.form1;
}
function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
    theForm.__EVENTARGUMENT.value = eventArgument;
    theForm.submit();
    }
}
//]]>
</script>

<div>

<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAwKP2r/ZCgLbzub6CgKJ+/qJC4VfHXBxZJkelz+i1sSmIFdWB5tZ" />
</div>
    <div style="overflow: auto;">

<table class="dxgvControl" cellspacing="0" cellpadding="0" id="FarmerInfoGridView" border="0" style="width:600px;border-collapse:collapse;border-collapse:separate;">
<tr>
    <td><table id="FarmerInfoGridView_DXMainTable" class="dxgvTable" cellspacing="0" cellpadding="0" border="0" style="width:100%;border-collapse:collapse;empty-cells:show;">
        <tr id="FarmerInfoGridView_DXDataRow0" class="dxgvDataRow">
            <td id="FarmerInfoGridView_tcrow0" colspan="7" style="border-right-width:0px;border-bottom-width:0px;">

                    <table width="100%" cellpadding="5" cellspacing="5">
                        <tr>
                            <td class="keyDescription">WFP ID:</td>
                            <td>asdf</td>
                        </tr>
                        <tr>
                            <td class="keyDescription">Name:</td>

                            <td>Name, Name</td>
                        </tr>
                        <tr>
                            <td class="keyDescription">Company Name:</td>
                            <td>Acme</td>
                        </tr>
                        <tr>

                            <td class="keyDescription">Address:</td>
                            <td>123 Lotus Lane</td>
                        </tr>
                        <tr>
                            <td class="keyDescription">City/State:</td>
                            <td>NY, NY</td>
                        </tr>

                        <tr>
                            <td class="keyDescription">Zip:</td>
                            <td>11111</td>
                        </tr>
                    </table>
            </td>
        </tr>
    </table><img id="FarmerInfoGridView_IADD" src="#" alt="|" style="border-width:0px;position:absolute;visibility:hidden;" /><img id="FarmerInfoGridView_IADU" src="/SAM_Project/WebResource.axd" alt="|" style="border-width:0px;position:absolute;visibility:hidden;" /><img id="FarmerInfoGridView_IDHF" src="/SAM_Project/WebResource.axd" alt="Hide" style="border-width:0px;position:absolute;visibility:hidden;" /><div id="FarmerInfoGridView_LP" align="center" style="left:0px;top:0px;z-index:30000;display:none;">

        <table class="dxgvLoadingPanel" cellspacing="0" cellpadding="0" border="0" style="border-collapse:collapse;">
            <tr>
                <td class="dx"><img src="/SAM_Project/WebResource.axd" alt="" align="middle" style="border-width:0px;" /></td><td class="dx" style="padding-left:0px;">Loading&hellip;</td>
            </tr>
        </table>
    </div><div id="FarmerInfoGridView_LD" class="dxgvLoadingDiv" style="display:none;z-index:29999;position:absolute;">

    </div><input type="hidden" name="FarmerInfoGridView$DXSelInput" id="FarmerInfoGridView_DXSelInput" /><table id="FarmerInfoGridView_DXStyleTable" border="0" style="display:none;">
        <tr>

            <td></td>
        </tr><tr class="dxgvEditingErrorRow">
            <td class="dxgv" colspan="7" style="border-right-width:0px;"></td>
        </tr><tr class="dxgvSelectedRow">
            <td></td>
        </tr><tr class="dxgvFocusedRow">
            <td></td>
        </tr><tr class="dxgvFocusedGroupRow">
            <td></td>

        </tr><tr class="dxgvDataRow">
            <td></td>
        </tr>
    </table><input type="hidden" name="FarmerInfoGridView$CallbackState" id="FarmerInfoGridView_CallbackState" value="#" /></td>
</tr>
</table><script id="dxss_27477558" type="text/javascript">
<!--

var dxo = new ASPxClientGridView('FarmerInfoGridView');
window['FarmerInfoGridView'] = dxo;
dxo.callBack = function(arg) {         WebForm_DoCallback('FarmerInfoGridView',arg,aspxCallback,'FarmerInfoGridView',aspxCallbackError,true);     };
dxo.callBacksEnabled=true;
dxo.pageRowCount=1;
dxo.pageRowSize=10;
dxo.selectedWithoutPageRowCount=0;
dxo.visibleStartIndex=0;
dxo.focusedRowIndex=-1;
dxo.allowFocusedRow=false;
dxo.allowMultiSelection=false;
dxo.isColumnsResizable=false;
dxo.isVerticalScrolling=false;
dxo.isHorizontalScrolling=false;
dxo.isMainControlResizable=false;
dxo.callbackOnFocusedRowChanged=false;
dxo.callbackOnSelectionChanged=false;
dxo.autoFilterDelay='1200';
dxo.ClearColumns();
dxo.CreateColumn('',0,'WFP_ID',1);
dxo.CreateColumn('',1,'Last_Name',1);
dxo.CreateColumn('',2,'First_name',1);
dxo.CreateColumn('',3,'Farm_Name',1);
dxo.CreateColumn('',4,'Address',1);
dxo.CreateColumn('',5,'City_State',1);
dxo.CreateColumn('',6,'Zip',1);
dxo.InlineInitialize();

//-->
</script>

    <table class="dxgvControl" cellspacing="0" cellpadding="0" id="AnimalGridView" border="0" style="width:600px;border-collapse:collapse;border-collapse:separate;">
<tr>

    <td><table id="AnimalGridView_DXMainTable" class="dxgvTable" cellspacing="0" cellpadding="0" border="0" style="width:100%;border-collapse:collapse;empty-cells:show;">
        <tr id="AnimalGridView_DXDataRow0" class="dxgvDataRow">
            <td id="AnimalGridView_tcrow0" colspan="43" style="border-right-width:0px;border-bottom-width:0px;">
        <table cellpadding="5" cellspacing="5" width="100%" id="rounded-corner">
            <tr>
                <th colspan="8" class="tableHeader">Animal Inventory</th>
            </tr>
            <tr>

                <td colspan="2">Updated:</td>
                <td colspan="2">11/14/2007</td>
                <td colspan="2">Total AU:</td>
                <td colspan="2">0</td>

            </tr>
            <tr>
                <td>Mature Dairy</td>

                <td>0</td>
                <td>Dairy Heifers</td>
                <td>0</td>
                <td>Veal</td>
                <td>0</td>
                <td>Beef</td>

                <td>0</td>
            </tr>
            <tr>
                <td>Calves</td>
                <td>0</td>
                <td>Bulls</td>
                <td>0</td>

                <td>Ducks</td>
                <td>0</td>
                <td>Elk</td>
                <td>0</td>
            </tr>
            <tr>
                <td>Sheep</td>

                <td>0</td>
                <td>Lambs</td>
                <td>0</td>
                <td>Geese</td>
                <td>0</td>
                <td>Buffalo</td>

                <td>0</td>
            </tr>
            <tr>
                <td>Goats</td>
                <td>2</td>
                <td>Kids</td>
                <td>0</td>

                <td>Rabbits</td>
                <td>0</td>
                <td>Bears</td>
                <td>0</td>
            </tr>
            <tr>
                <td>Pigs</td>

                <td>0</td>
                <td>Piglets</td>
                <td>0</td>
                <td>Emu</td>
                <td>0</td>
                <td>Mountain Lion</td>

                <td>0</td>
            </tr>
            <tr>
                <td>Horses</td>
                <td>0</td>
                <td>Foals</td>
                <td>0</td>

                <td>Ostrich</td>
                <td>0</td>
                <td>Guinea Pigs</td>
                <td>0</td>
            </tr>
            <tr>
                <td>Donkeys</td>

                <td>0</td>
                <td>Oxen</td>
                <td>0</td>
                <td>Walaroo</td>
                <td>0</td>
                <td>Greenhouse</td>

                <td>0</td>
            </tr>
            <tr>
                <td>Chickens</td>
                <td>0</td>
                <td>Turkeys</td>
                <td>0</td>

                <td>Llama</td>
                <td>0</td>
                <td>Vegetables</td>
                <td>0</td>
            </tr>
            <tr>
                <td>Ginny Hens</td>

                <td>0</td>
                <td>Peacock</td>
                <td>0</td>
                <td>Alpaca</td>
                <td>0</td>
                <td>Pheasant</td>

                <td>0</td>
            </tr>
            <tr>
                <td>Deer</td>
                <td>0</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>

                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
            </tr>
        </table>
</td>
        </tr>
    </table><img id="AnimalGridView_IADD" src="/SAM_Project/WebResource.axd" alt="|" style="border-width:0px;position:absolute;visibility:hidden;" /><img id="AnimalGridView_IADU" src="/SAM_Project/WebResource.axd" alt="|" style="border-width:0px;position:absolute;visibility:hidden;" /><img id="AnimalGridView_IDHF" src="/SAM_Project/WebResource.axd" alt="Hide" style="border-width:0px;position:absolute;visibility:hidden;" /><div id="AnimalGridView_LP" align="center" style="left:0px;top:0px;z-index:30000;display:none;">

        <table class="dxgvLoadingPanel" cellspacing="0" cellpadding="0" border="0" style="border-collapse:collapse;">
            <tr>
                <td class="dx"><img src="/SAM_Project/WebResource.axd" alt="" align="middle" style="border-width:0px;" /></td><td class="dx" style="padding-left:0px;">Loading&hellip;</td>
            </tr>
        </table>
    </div><div id="AnimalGridView_LD" class="dxgvLoadingDiv" style="display:none;z-index:29999;position:absolute;">

    </div><input type="hidden" name="AnimalGridView$DXSelInput" id="AnimalGridView_DXSelInput" /><table id="AnimalGridView_DXStyleTable" border="0" style="display:none;">
        <tr>

            <td></td>
        </tr><tr class="dxgvEditingErrorRow">
            <td class="dxgv" colspan="43" style="border-right-width:0px;"></td>
        </tr><tr class="dxgvSelectedRow">
            <td></td>
        </tr><tr class="dxgvFocusedRow">
            <td></td>
        </tr><tr class="dxgvFocusedGroupRow">
            <td></td>

        </tr><tr class="dxgvDataRow">
            <td></td>
        </tr>
    </table><input type="hidden" name="AnimalGridView$CallbackState" id="AnimalGridView_CallbackState" value="#" /></td>
</tr>
</table><script id="dxss_1369069069" type="text/javascript">
<!--

var dxo = new ASPxClientGridView('AnimalGridView');
window['AnimalGridView'] = dxo;
dxo.callBack = function(arg) {     WebForm_DoCallback('AnimalGridView',arg,aspxCallback,'AnimalGridView',aspxCallbackError,true);     };
dxo.callBacksEnabled=true;
dxo.pageRowCount=1;
dxo.pageRowSize=10;
dxo.selectedWithoutPageRowCount=0;
dxo.visibleStartIndex=0;
dxo.focusedRowIndex=-1;
dxo.allowFocusedRow=false;
dxo.allowMultiSelection=false;
dxo.isColumnsResizable=false;
dxo.isVerticalScrolling=false;
dxo.isHorizontalScrolling=false;
dxo.isMainControlResizable=false;
dxo.callbackOnFocusedRowChanged=false;
dxo.callbackOnSelectionChanged=false;
dxo.autoFilterDelay='1200';
dxo.ClearColumns();
//-->
</script>


    <div style="margin-left: auto; margin-right: auto; width: 450px;padding: 5px 5px;"><input id="btnClose" type="submit" value="Close Window" onclick="window.close();" /></div>
</div>



<script type="text/javascript">
//<![CDATA[

WebForm_InitCallback();//]]>
</script>
</form>
</body>
</html>

7 个答案:

答案 0 :(得分:3)

如果您想要始终在页面上强制滚动条,请尝试将以下CSS添加到页面中:

html {
overflow-y:scroll;
}

这将使页面始终具有垂直滚动条,无论是否需要。

您可能还想更改要使用的代码:

windowHandle = window.open(pageUrl, "FarmQuery", 'resizable=1,scrollbars=1');

as 1 = yes / true但是yes不一定等于1 / true(有趣的跨浏览器逻辑!)。

答案 1 :(得分:1)

这听起来像是一个CSS问题。

尝试从弹出页面中删除指向CSS文件的链接,然后查看问题是否仍然存在(我打赌它不会)。

然后,这成为一个新问题:什么CSS可能导致滚动条在页面上消失?

身体overflow: hidden;的规则很可能是罪魁祸首。

答案 2 :(得分:0)

您是否尝试将主浏览器窗口的大小调整为大小与弹出窗口大小相同并直接导航到弹出窗口中显示的页面?直接加载页面时是否显示滚动条?弹出窗口可能是一个红色的鲱鱼。

答案 3 :(得分:0)

如果内容不适合客户区,则只有在打开新窗口时才会显示滚动条。尝试在选项中添加“width = 600,height = 600”以减小窗口大小......如果没有条形图出现,则更可能是css问题。

删除“default.css”行。你还遇到问题吗?

答案 4 :(得分:0)

当我尝试你提供的html,并且我调整窗口大小以使内容不适合时,我在div上显示滚动条(它看起来比整个窗口略小)。我尝试删除div标签上的style="overflow: auto;",滚动条仅应用于整个窗口。这似乎有效,当你说滚动条不适用时,我首先想到的是它是CSS文件中定义的导致问题的东西。它可能位于 ../ Default.css ReportData.css

如果div的样式在其中一个css文件中设置为overflow:hidden,则可以覆盖此设置以在页面上的div标记中设置style="overflow: visible;"。这将导致div的内容不被剪裁,并且滚动由窗口而不是div标签处理。

如果不是div标签,则可能是其他标签。在css文件中的任何标签上查找overflow: hidden,看看是否存在问题。

答案 5 :(得分:0)

在您的css文件中可能存在一个位置:已阻止滚动条出现。

答案 6 :(得分:0)

window.open('CHFPhoneMonitoringChecklist.html','CHFwin','resizable = yes,location = 1,status = 1,scrollbars = 1,width = 1250,height = 1000');