无法在网页上隐藏垂直滚动条 [英] Unable to Hide Vertical Scroll Bar on Web Page

查看:103
本文介绍了无法在网页上隐藏垂直滚动条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 函数loadProject (sel){
var url = sel [sel.selectedIndex] .value;
$ b $ if if(url){
document.getElementById('projectContainer')。innerHTML ='<'+'object id =fooname =footype =text / htmldata ='+ url +'>< \ / object>';
} else {
document.getElementById('projectContainer')。innerHTML =请选择一个项目。;
}
}

而且,我在HTML中有一个div标签, projectContainer的id。这是有效的,除了垂直滚动条始终显示的事实,无论我如何删除它。 (它不应该是 - 即使我没有在对象中放置任何东西,竖线仍然显示。)我试图编辑下面的CSS:

  object {
width:100%;
border:none;
overflow:hidden;
}

但是这并不是我正在寻找的东西。有什么建议么?感谢。

解决方案

使用< object> 但是与iframe非常相似,我想:这意味着有一个与周围文档分开的文档体。



您需要声明 overflow:hidden ,以便嵌入文档中的 body

I am displaying an HTML page within another HTML page depending on which link is selected using the following function:

function loadProject(sel) {
    var url = sel[sel.selectedIndex].value;

    if(url) {
        document.getElementById('projectContainer').innerHTML = '<' + 'object id="foo" name="foo" type="text/html" data="'+url+'"><\/object>';
    } else {
        document.getElementById('projectContainer').innerHTML = "Please select a project.";
    }
}

And, I have a div tag inside the HTML with the id of projectContainer. This works, except for the fact that a vertical scroll bar is always shown no matter what I do to remove it. (It shouldn't be - even if I put nothing into the object, the vertical bar is still shown.) I have tried to edit the CSS in the following:

object {
    width: 100%; 
    border: none;
    overflow: hidden;
}

but that is not accomplishing what I'm looking for. Any suggestions? Thanks.

解决方案

Using an <object> is new to me but very similar to an iframe, I suppose: It means that there is a document body that is separate from the surrounding document.

You need to declare overflow: hidden for the body inside the document you are embedding.

这篇关于无法在网页上隐藏垂直滚动条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆