2011-02-18 32 views
0

我想在jwysiwyg iframe中關注光標,當用戶忘記輸入一個值,但我不知道如何做到這一點。有人可以幫忙嗎?使用jwysiwyg和驗證問題

回答

1

首先,沒有通過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 
    }); 
});