Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/73.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript iframe禁用选项卡上的滚动_Javascript_Html_Css_Iframe - Fatal编程技术网

Javascript iframe禁用选项卡上的滚动

Javascript iframe禁用选项卡上的滚动,javascript,html,css,iframe,Javascript,Html,Css,Iframe,我有一个iframe,看起来像这样: <!DOCTYPE html> <html> <body> <iframe src="http://www.w3schools.com" style = 'height:100px;width:200px;' scrolling = 'no'> <p>Your browser does not support iframes.</p> </iframe> </

我有一个iframe,看起来像这样:

<!DOCTYPE html>
<html>
<body>

<iframe src="http://www.w3schools.com" style = 'height:100px;width:200px;' scrolling = 'no'>
  <p>Your browser does not support iframes.</p>
 </iframe>

</body>
</html>

您的浏览器不支持iFrame

所以当我在iframe中按tab键时,它会遍历所有链接,自动调用滚动到iframe中站点的底部。我想做的是使iframe只在高度为100px,宽度为200px的矩形框中创建选项卡,并忽略站点上的所有其他内容…基本上剪辑不适合此矩形的所有其他内容


我尝试设置高度和宽度,还设置了overflow:hidden,但这似乎不起作用。

这会阻止用户单击iframe中的任何内容,但出于某种原因,您仍然可以单击内部并通过选项卡:-(


您的浏览器不支持iFrame


您对此无能为力,但您可以在iframe加载上运行JS,该加载可以从您不希望显示的iframe中隐藏html内容

你可以参考这些类似的问题来获得想法:


  • 在jQuery论坛上也有类似的讨论:

    你的代码在chrome和ie10上运行。不,但它可以在w3schools网站上的所有内容上进行标签操作。我希望它只能通过200px 100px窗口中显示的任何内容进行标签操作。w3schools网站上任何不属于此窗口的链接都不应该集中在al上l关于制表符。请提供一个JSFIDLE示例,这似乎有效。影响制表符顺序的唯一方法是设置。由于您的
    iframe
    中有一个,因此您无能为力。还尝试将
    制表符索引:-1
    同时设置为iframe和包装div,但没有效果
    <div id="IframeWrapper" style="position: relative;">
        <div id="iframeBlocker" style="position: absolute; top: 0; left: 0; width: 400px; height: 200px"></div>
        <iframe src="http://www.w3schools.com" style='height:200px;width:400px;' scrolling='no'>
            <p>Your browser does not support iframes.</p>
        </iframe>
    </div>