首页 > 解决方案 > 按键盘上的“Enter”键时更改 IFRAME 地址

问题描述

我创建了一个带有两个 IFRAME 窗口的 HTML 页面。

当按下“Enter”键时,我想更改它们之间的地址。谢谢!

<body style="background-color:black;">
<iframe class="g" src="www.example.com"  scrolling="no" frameborder="0"  height="100%" width="100%" allowfullscreen></iframe>
<div id="overlay"><iframe src="www.wow.com" scrolling="no" frameborder="0" marginheight="0px"  height="205px" width="360px" allowfullscreen></iframe>
<style>  #overlay {
  position: absolute; 
  top: 430px;
      right: 15px;

  color: #FFF; 
  text-align: center;
  font-size: 20px;
  width: 400px;
  padding: 10px 0;
  z-index: 2147483647;
}

.g {
    height: 100%;
}

#v {
  z-index: 1;
}</style></div><div style='text-align: right;position: fixed;z-index:9999999;bottom: 0; width: 100%;cursor: pointer;line-height: 0;display:block !important;'></div></body>

标签: javascripthtmlcss

解决方案


在此处应用 Javascript。

Onsubmit/onclick enter key 你必须设置 iframe 标签的 src 属性。


推荐阅读