javascript - 按键盘上的“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>
解决方案
在此处应用 Javascript。
Onsubmit/onclick enter key 你必须设置 iframe 标签的 src 属性。
推荐阅读
- html - 将容器移到页脚上方
- r - 使用 hc_add_series_map() 而不是 hcmap() 在地图上可视化气泡
- spring - 如何使用本机查询映射嵌套投影
- mysql - 我无法弄清楚 MySQL 有什么问题不断收到错误 1064
- python - 当代码在python中运行x次时,如何在代码中运行函数的特定部分?
- python - 如何压缩文件夹中的图像,使其总大小低于一定数量?
- java - JavaFX:显示时动态更新菜单
- html - 大于其属性
- regex - 通过gsub在ruby中查找双引号之间的文本
- c++ - glReadPixels depth_buffer_component 总是返回 1