问下怎么给IFRAME 设置焦点,网上查了些方式都不行啊,设置不了。<iframe id="contents" name="contents" frameborder="0" marginheight="0" marginwidth="0" scrolling="auto"></iframe>window.onload = function()
{
var f = window.frames["contents"];
f.document.designMode="on";
f.focus(); //设置焦点无效
document.getElementById("translate_x").checked = true;
}
{
var f = window.frames["contents"];
f.document.designMode="on";
f.focus(); //设置焦点无效
document.getElementById("translate_x").checked = true;
}
要写在onload事件里才行
<iframe id="contents" name="contents" frameborder="0" marginheight="0" marginwidth="0" scrolling="auto" onload="_load()"></iframe>
<script>
function _load(){
var f = window.frames["contents"];
f.document.designMode="on";
f.focus(); //设置焦点无效
document.getElementById("translate_x").checked = true;}
</script>这样写~·
function insertimage()
{ var f = window.frames["contents"];
f.focus();
}这个focus 也没用啊
var f = window.frames["contents"];
f.document.designMode="on";
f.focus(); //设置焦点无效
document.getElementById("translate_x").checked = true;