goldmonkey Posted December 24, 2009 at 02:17 AM Report Share #302234 Posted December 24, 2009 at 02:17 AM Olá pessoal, tenho uma pequena dúvida como poderia fazer aparecer botão escondido através de uma checkbox, marco a checkbox e o botão aparece. Link to comment Share on other sites More sharing options...
bruno1234 Posted December 24, 2009 at 03:03 PM Report Share #302264 Posted December 24, 2009 at 03:03 PM Experimenta com o evento onchange. Matraquilhos para Android. Gratuito na Play Store. https://play.google.com/store/apps/details?id=pt.bca.matraquilhos Link to comment Share on other sites More sharing options...
goldmonkey Posted December 24, 2009 at 05:19 PM Author Report Share #302278 Posted December 24, 2009 at 05:19 PM Tipo como chamar a função eu sei, eu não sei é como fazer uma função que o mostre. Eu não percebo nada de javascript mas estava a pensar algo do género: Quando eu marca-se a checkbox adicionava ou editava uma div. Link to comment Share on other sites More sharing options...
goldmonkey Posted December 24, 2009 at 05:33 PM Author Report Share #302279 Posted December 24, 2009 at 05:33 PM Pesquisei um pouco e deu nisto: function mostra(m) { if (m) { var botao = document.createElement('div'); botao.appendChild(document.createTextNode("<input type="submit" name="submit" value="Enviar dados"/>"); var b = document.getElementById('botao'); b.parentNode.replaceChild(botao,b); } else { ficava vazio } na página a div ficaria vazia Daria para fazer isto? Link to comment Share on other sites More sharing options...
goldmonkey Posted December 25, 2009 at 12:02 PM Author Report Share #302342 Posted December 25, 2009 at 12:02 PM Descobri que era possivel fazer document.getElementById('id').style.visibility='hidden'; Então fiz o seguinte: function mostra() { if(botao.checked) document.getElementById('botao').style.visibility='hidden'; else document.getElementById('botao').style.visibility='visible'; } Só que ao clicar mostra o botão escondido mas quando volto a clicar ele não se esconde 😁 Link to comment Share on other sites More sharing options...
NCS_One Posted December 25, 2009 at 02:38 PM Report Share #302357 Posted December 25, 2009 at 02:38 PM Boas. function mostrar() { var Elm = document.getElementById("botao"); if(Elm.checked == true) { Elm.style.visibility='hidden'; Elm.checked = false; } else { Elm.style.visibility='visible'; Elm.checked = true; } } Se a vida te voltar as costas aproveita e apalpa-lhe o cu. Link to comment Share on other sites More sharing options...
goldmonkey Posted December 25, 2009 at 05:35 PM Author Report Share #302380 Posted December 25, 2009 at 05:35 PM Espectáculo agora dá direitinho, muito obrigado 😁 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now