当用户忘记输入值时,我希望将光标放在jwysiwyg iframe中,但我不确定如何做到这一点。有人能帮帮忙吗?
发布于 2011-02-18 14:05:55
首先,没有通过javascript移动鼠标的机制。
要在iframe中聚焦,请使用以下脚本(如果使用jquery)
$(".wysiwyg").find("iframe").focus();要访问iframe的内容,您必须使用上面的脚本:
$(document).ready(function(){
$(".wysiwyg").find("iframe").load(function(){
var test = $(".wysiwyg").find("iframe").contents().find('body').html();
//do job with the content.
//Remember that jwysiwyg will produse some code even if it seems there is
//nothing.(couse the wysiwyg is base on browser behavor
});
});https://stackoverflow.com/questions/5037919
复制相似问题