0
I have the following select with onChange generating:
<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 for the page,.
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 generate Image, but I’m not able to manipulate it via javascript since it uses an options parameter. The function works correctly if the option is activated manually, but calling in 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) ...
}
?? This line is not wrong, I get error in it because I could not pass the options so can not find options.id
– Stenio Vilar
in the options[Document.getElementById('type'). value] snippet tries to exchange value for selectedIndex
– silasq
worked, thanks, edits the main reply I accept the reply
– Stenio Vilar