父页面select下拉框选择后跳转到iframe子页面,并滚动到相应的位置

1、父页面增加的select选项,并引用iframe链接

父页面select下拉框选择后跳转到iframe子页面,并滚动到相应的位置

2、与上图同在一个页面,使用iframe嵌套显示具体内容

<div class="healthprtcontent">

       <iframe src="editright.html" id="iframepage" name="iframepage" frameborder="0" class="layadmin-iframe">

      </iframe>

  </div>

3、iframe页面dom 定义id 与父页面value值相对应。

父页面select下拉框选择后跳转到iframe子页面,并滚动到相应的位置

4、由于使用layui框架,这里用form监听获取到select的选中值实现跳转

  /**监听select*/

  form.on('select(healthSelect)', function (data) {

                var healthVal = data.value;//获取唯一属性值

                window.frames["iframepage"].document.getElementById('' + healthVal + '').scrollIntoView();

})