如何改变iframe的焦点? [英] How to change focus out of iframe?
本文介绍了如何改变iframe的焦点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
获得一些加载输入
框的代码,然后在 iframe
下面加上 textarea
...问题是我希望在页面加载时将焦点放在输入
框中,但它始终跳转到 textarea
因为iframe加载了第二个...
Got some code which loads an input
box, and then below this is an iframe
with a textarea
... Problem is I want the focus to be on the input
box when the page loads, but it always jumps to the textarea
because the iframe loads second...
如何关注页面中的第一个元素?
How do I keep focus on the first element in the page?
推荐答案
将它放在iframe代码中。
Put this inside the iframe code.
<script language="text/javascript">
window.parent.document.getElementById("idOfInput").focus();
</script>
这篇关于如何改变iframe的焦点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文