Javascript-在弹出窗口中滚动到底部 //弹出窗口代码 函数newPopup(url){ 打开(url,'popupWindow','height=500,width=800,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes') } 去谷歌。

Javascript-在弹出窗口中滚动到底部 //弹出窗口代码 函数newPopup(url){ 打开(url,'popupWindow','height=500,width=800,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes') } 去谷歌。,javascript,html,popup,Javascript,Html,Popup,当用户单击网页上的单击此处时,会出现一个弹出窗口,它会将您指向http://www.google.ca网页。我的问题是如何使弹出窗口在单击单击此处时自动滚动到页面底部 我发现这个代码段: window.scrollBy(0,50),但它会将网站本身滚动到底部。它不会滚动弹出窗口。您可以尝试创建锚点吗 <script type="text/javascript"> // Popup window code function newPopup(url) { popupWindow

当用户单击网页上的
单击此处
时,会出现一个弹出窗口,它会将您指向
http://www.google.ca
网页。我的问题是如何使弹出窗口在单击
单击此处时自动滚动到页面底部

我发现这个代码段:
window.scrollBy(0,50)
,但它会将网站本身滚动到底部。它不会滚动弹出窗口。

您可以尝试创建锚点吗

<script type="text/javascript">
// Popup window code
function newPopup(url) {
    popupWindow = window.open(url,'popUpWindow','height=500, width=800, left=10, top=10, resizable=yes, scrollbars=yes, toolbar=yes, menubar=no, location=no, directories=no, status=yes')
}
</script>


<a href="JavaScript:newPopup('http://www.google.ca');">CLICK HERE</a></a> to go to google.


我不确定你是否可以用JavaScript激活一个锚,但这是我知道的唯一一种强迫用户在网页上向下滚动的方法。希望这有帮助

尝试使用
onload
这样的事件

<a name="whereYouWantToScrollTo">Click To Scroll To Top</A> 

如果您的弹出窗口有一个id,您可以使用此代码进入该弹出窗口的顶部

function newPopup(url) {
    popupWindow = window.open(url,'popUpWindow','height=500, width=800, left=10, top=10, resizable=yes, scrollbars=yes, toolbar=yes, menubar=no, location=no, directories=no, status=yes');
    popupWindow.onload = function () {
        popupWindow.scrollTo(0, popupWindow.document.body.scrollHeight);
    };
}
当弹出窗口为:

$("#confirma_modificacion_documento").animate({ scrollTop: 0 }, "fast");

它似乎没有滚动到弹出窗口的底部。我正在使用谷歌浏览器。主窗口和次窗口中的域名必须相同。这是因为跨域脚本安全限制(也称为“同源策略”)。我使用了你的代码,但它对我的弹出窗口没有任何作用。耶!它的工作:)SOP将阻止,如果它的不同领域!
<div class="modal fade" id="confirma_modificacion_documento" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"