I have the following select with the onChange generateImage working correctly:
<select id="tipo" name="tipo" onchange="gerarImagem(this.options[this.selectedIndex])">
<option value=""></option>
<c:forEach items="${FORM.listaTipos}" var="t">
<option value="${t.codTipo}" id="${t.qtdMaxReg}">${t.descTipo}</option>
</c:forEach>
</select>
And the following init to the page, I'm not sure what to pass as parameter in the call generateImage so you can manipulate these options via JavaScript.
function init() {
if(document.getElementById('tipo').value != null){
gerarImagem(document.getElementById('tipo').options[document.getElementById('tipo').value]); //ESTOU PASSANDO O PARÂMETRO OPCOES ERRADO AQUI, O QUE PODE SER FEITO?
}
}
I have this function generateImage, however I can not manipulate it via javascript since it uses an options parameter. The function works correctly if the option is activated manually, but calling init does not.
function gerarImagem(opcoes) {
var spanImagem = document.getElementById('spanImagem');
var maxReg = opcoes.id; //ERRO
dwr.util.byId("tdUpload").style.visibility = 'visible';
dwr.util.byId("tdUploadTxt").style.visibility = 'hidden';
switch(opcoes.value) ...
}