相关疑难解决方法(0)

如何在HTML iFrame中检测滚动条的存在(使用Javascript)?

如何在HTML iFrame中检测滚动条的存在(使用Javascript)?

我已经尝试过了:

        var vHeight = 0;
        if (document.all) {
          if (document.documentElement) {
            vHeight = document.documentElement.clientHeight;
          } else {
            vHeight = document.body.clientHeight
          }
    } else {
      vHeight = window.innerHeight;
    }

    if (document.body.offsetHeight > vHeight) {
      //when theres a scrollbar
    }else{
      //when theres not a scrollbar
    }
Run Code Online (Sandbox Code Playgroud)

我也尝试过:

           this.scrollLeft=1;
    if (this.scrollLeft>0) {
        //when theres a scrollbar
        this.scrollLeft=0;
        }else{
        //when theres not a scrollbar
        return false;
    }
Run Code Online (Sandbox Code Playgroud)

没有成功..

我在DOM Inspector上搜索了javascript objets,但没有找到任何内容.

是否可以在javacscript中检测iframe中的滚动条存在?


iframe内容来自同一个域.

直到现在都没有成功..

alt text http://www.upvtp.com.br/file.php/1/help_key.jpg

html javascript iframe dom scrollbar

21
推荐指数
2
解决办法
4万
查看次数

标签 统计

dom ×1

html ×1

iframe ×1

javascript ×1

scrollbar ×1