如何使iframe中页面获得焦点??

如何使iframe中页面获得焦点??,第1张

script language=javascript>

function insertHtml(HtmlCode)

{

var win=window.content_html.idEditbox.document//其中编辑区域是gledit.htm中的一个iframe,id是idEditbox

window.content_html.idEditbox.focus()//是编辑器获得焦点,防止代码插入在编辑器外地方

win.selection.createRange().pasteHTML(HtmlCode)//在光标的位置插入html代码

}

</script>

http://webuc.net/dotey/articles/198.aspx说的比较详细

document.body.appendChild("<iframe id='ifm'>...")

setTimeout(function () { document.getElementById('ifm').focus()}, 50)


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/tougao/11372666.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-15
下一篇 2023-05-15

发表评论

登录后才能评论

评论列表(0条)

保存