Tenho um editor html, e quando ele é iniciado o cursor nao seta automatico. Tentei fazer com a linha
document.getElementById(’${propriedade}’).focus(); … porem nao esta funcionando… Por favor, alguem pode me ajudar?
Obrigado,
tinyMCE.init({
theme : “advanced”,
auto_reset_designmode : true,
mode : “exact”,
language : “pt_br”,
elements : “editorPopUp”,
width:“596”,
height:“600”,
valid_elements : “<em>[</em>]”,
plugins : “style,print”,
verify_css_classes : “false”,
theme_advanced_buttons1 : “bold,italic,underline,separator,justifyleft,justifycenter,justifyright,justifyfull,|,bullist,numlist,outdent,indent,|,fontselect,fontsizeselect”,
theme_advanced_buttons2 : “undo,redo,|,forecolor,backcolor”,
theme_advanced_buttons3 : “”,
theme_advanced_toolbar_location : “top”,
theme_advanced_toolbar_align : “left”,
spellchecker_languages : “+English=en”,
verify_html : “false”
});
function carregaEditor(){
var conteudo = opener.document.getElementById('<%=request.getParameter("campoAtual")%>').contentWindow.document.getElementById('divPaginaEmBranco').innerHTML;
if (tinyMCE.getInstanceById("editorPopUp") != null)
{
try
{
var editor = tinyMCE.getInstanceById("editorPopUp");
editor.setHTML(conteudo);
return;
}
catch ( err )
{
// alert(err);
}
}
else
{
tinyMCE.idCounter=0;
tinyMCE.execCommand('mceAddControl', false, "editorPopUp");
}
document.getElementById('mce_editor_0').focus();
return;
}
function descarregaEditor(){
if (tinyMCE.getInstanceById("editorPopUp") != null)
{
try
{
var editor = tinyMCE.getInstanceById("editorPopUp");
opener.document.getElementById('<%=request.getParameter("campoAtual")%>').contentWindow.document.getElementById('divPaginaEmBranco').innerHTML=editor.getHTML();
var campoAtual = '<%=request.getParameter("campoAtual")%>';
var campo = campoAtual.substring(campoAtual.lastIndexOf('_')+1);
opener.document.getElementById(campo).value=editor.getHTML();
window.close();
}
catch ( err )
{
alert("Erro de Edição. Feche o editor e tente novamente.");
}
}
}
</script>
</head>
<body onload="setTimeout('carregaEditor()', 500);">
<table align="center">
<tr>
<td>
<div id="editor" align="center" border="1">
<textarea cols="100" rows="10" name="comentario" id="editorPopUp"></TEXTAREA>
</div>
</td>
</tr>
<tr>
<td>
<button onclick="descarregaEditor()" style="width:598;height:50">Voltar</button>
</td>
</tr>
</table>
</body>
</html>