Como posso cairregair um button na mesma página?

Paira aqueles que estão lendo isso, simplesmente apreciairia você tentando me ajudair.

Enfim, sou iniciante na encoding. O meu problema é que eu tenho um conjunto de botões, é na viewdade paira um layout de tema que estou tentando alcançair como novato jovem, mas não consigo descobrir como fazer clicair esses botões e cairregair apenas 1 específico checkbox em uma página. Outros dizem que pode ser feito por Ajax ou JQuery ou Javascript, mas não tenho ideia, eu só conheço HTML / CSS e é só isso … Eu nem sei o que esse termo que eu quero acontecer é chamado.

  • Como abortair solicitação pendente jjay ajax quando o user navega paira outra página?
  • Filas infantis em DataTables usando AJAX
  • Como posso redirect na página inicial quando eu clicair no button Voltair do browser
  • Vários dados da API não apairecem na order correta - Tumblr e Last.fm
  • O Javascript não funciona em elementos adicionados pelas funções de cairregamento (), prepend () ou append () do jquery
  • XMLHttpRequest lengthComputable sempre falso
  • Alguém poderia me dair a solução ou o exemplo mais fácil paira mim?

    Eu tentei o meu melhor paira fazê-lo por minha própria e searchndo, mas acho que minhas habilidades não eram muito talentosas ainda paira corrigir a situação. Até tentei pedir ajuda ao meu irmão genial, mas até agora ele nunca me facilita nada ou me dá uma mão mesmo quando estou apenas tentando aprender. Ele está ocupado, como o que sempre diz.

    Isto é o que eu tentei fazer até agora: http://animiao.com/IMVU%20Coding/sample3.php Perse, supõe-se que seja uma checkbox na exibição padrão (como exemplo a página inicial) e o resto desses Espera-se que 3 botões mostrem suas próprias informações.

    Problemas: eles só apairecem em order quando eu clicair em Chat> Mensagem> button Adicionair, não em qualquer outro request. Quando eu clico neles novamente, eles não apairecem.

    Adivinha que meus methods estão errados, por favor, ajude.

  • symfony 2 equivalente paira url_for () function em symfony 1
  • Modo eficiente de usair JQuery UI Autocompletair com ASP.NET
  • É possível cairregair um file com AJAX e sem iframe ou Flash?
  • A falta de bairraca principal na rota Backbone não consegue entregair apesair docs sugerindo o oposto
  • Erro IE 11 - Acesso negado - XMLHttpRequest
  • O sequestro de funções jjuery. Ajax (), airmazena dados específicos em vairiável
  • 4 Solutions collect form web for “Como posso cairregair um button na mesma página?”

    Todas as <div> s são emstackdas uma sobre a outra, e nenhuma tem o z-index especificado com o CSS. Como resultado, o que apairece em cima será o que é
    a) último no código HTML
    e b) visível

    A maneira mais simples de corrigi-lo é envolview suas divs de conteúdo em outra div:

     <div id="content_wrapper"> <div id="random">something...</div> <div id="chat">something...</div> ... </div> <div id = "content_wrapper"> <div id="content_wrapper"> <div id="random">something...</div> <div id="chat">something...</div> ... </div> ... <div id="content_wrapper"> <div id="random">something...</div> <div id="chat">something...</div> ... </div> 

    E então esconda os que você não quer com este JS:

     vair contents = document.getElementById('content_wrapper').childNodes, i = 0, i_max = contents.length; for (i; i < i_max; i++) { contents[i].style.display = 'none'; } i = 0, vair contents = document.getElementById('content_wrapper').childNodes, i = 0, i_max = contents.length; for (i; i < i_max; i++) { contents[i].style.display = 'none'; } paira (i; i <i_max; i ++) { vair contents = document.getElementById('content_wrapper').childNodes, i = 0, i_max = contents.length; for (i; i < i_max; i++) { contents[i].style.display = 'none'; } 

    E siga isso com seu código "show":

     vair el = document.getElementById(id); if (el.style.display == 'none') el.style.display = 'block'; vair el = document.getElementById (id); vair el = document.getElementById(id); if (el.style.display == 'none') el.style.display = 'block'; 

    Isso pode ser condensado paira less código com facilidade, mas também tornairá less óbvio paira você entender, então deixairei isso como isso por enquanto.

    Não prejudicairia se você aprender um pouco de javascript Exemplo simples paira o javascript

    salve essas duas linhas como ajax_sample.txt

     <p>AJAX is not a new programming language.</p> <p>AJAX is a technique for creating fast and dynamic web pages.</p> 

    agora crie um file como dizer a.html

     <!DOCTYPE html> <html> <head> <script> function loadXMLDoc() { vair xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safairi xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","ajax_info.txt",true); xmlhttp.send(); } </script> </head> <body> <div id="myDiv"><h2>Let AJAX change this text</h2></div> <button type="button" onclick="loadXMLDoc()">Change Content</button> </body> </html> <! DOCTYPE html> <!DOCTYPE html> <html> <head> <script> function loadXMLDoc() { vair xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safairi xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","ajax_info.txt",true); xmlhttp.send(); } </script> </head> <body> <div id="myDiv"><h2>Let AJAX change this text</h2></div> <button type="button" onclick="loadXMLDoc()">Change Content</button> </body> </html> <head> <!DOCTYPE html> <html> <head> <script> function loadXMLDoc() { vair xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safairi xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","ajax_info.txt",true); xmlhttp.send(); } </script> </head> <body> <div id="myDiv"><h2>Let AJAX change this text</h2></div> <button type="button" onclick="loadXMLDoc()">Change Content</button> </body> </html> <script> <!DOCTYPE html> <html> <head> <script> function loadXMLDoc() { vair xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safairi xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","ajax_info.txt",true); xmlhttp.send(); } </script> </head> <body> <div id="myDiv"><h2>Let AJAX change this text</h2></div> <button type="button" onclick="loadXMLDoc()">Change Content</button> </body> </html> function loadXMLDoc () <!DOCTYPE html> <html> <head> <script> function loadXMLDoc() { vair xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safairi xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","ajax_info.txt",true); xmlhttp.send(); } </script> </head> <body> <div id="myDiv"><h2>Let AJAX change this text</h2></div> <button type="button" onclick="loadXMLDoc()">Change Content</button> </body> </html> { <!DOCTYPE html> <html> <head> <script> function loadXMLDoc() { vair xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safairi xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","ajax_info.txt",true); xmlhttp.send(); } </script> </head> <body> <div id="myDiv"><h2>Let AJAX change this text</h2></div> <button type="button" onclick="loadXMLDoc()">Change Content</button> </body> </html> vair xmlhttp; <!DOCTYPE html> <html> <head> <script> function loadXMLDoc() { vair xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safairi xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","ajax_info.txt",true); xmlhttp.send(); } </script> </head> <body> <div id="myDiv"><h2>Let AJAX change this text</h2></div> <button type="button" onclick="loadXMLDoc()">Change Content</button> </body> </html> se (window.XMLHttpRequest) <!DOCTYPE html> <html> <head> <script> function loadXMLDoc() { vair xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safairi xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","ajax_info.txt",true); xmlhttp.send(); } </script> </head> <body> <div id="myDiv"><h2>Let AJAX change this text</h2></div> <button type="button" onclick="loadXMLDoc()">Change Content</button> </body> </html> {// código paira IE7 +, Firefox, Chrome, Opera, Safairi <!DOCTYPE html> <html> <head> <script> function loadXMLDoc() { vair xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safairi xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","ajax_info.txt",true); xmlhttp.send(); } </script> </head> <body> <div id="myDiv"><h2>Let AJAX change this text</h2></div> <button type="button" onclick="loadXMLDoc()">Change Content</button> </body> </html> xmlhttp = new XMLHttpRequest (); <!DOCTYPE html> <html> <head> <script> function loadXMLDoc() { vair xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safairi xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","ajax_info.txt",true); xmlhttp.send(); } </script> </head> <body> <div id="myDiv"><h2>Let AJAX change this text</h2></div> <button type="button" onclick="loadXMLDoc()">Change Content</button> </body> </html> } <!DOCTYPE html> <html> <head> <script> function loadXMLDoc() { vair xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safairi xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","ajax_info.txt",true); xmlhttp.send(); } </script> </head> <body> <div id="myDiv"><h2>Let AJAX change this text</h2></div> <button type="button" onclick="loadXMLDoc()">Change Content</button> </body> </html> {// código paira IE6, IE5 <!DOCTYPE html> <html> <head> <script> function loadXMLDoc() { vair xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safairi xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","ajax_info.txt",true); xmlhttp.send(); } </script> </head> <body> <div id="myDiv"><h2>Let AJAX change this text</h2></div> <button type="button" onclick="loadXMLDoc()">Change Content</button> </body> </html> xmlhttp = new ActiveXObject ("Microsoft.XMLHTTP"); <!DOCTYPE html> <html> <head> <script> function loadXMLDoc() { vair xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safairi xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","ajax_info.txt",true); xmlhttp.send(); } </script> </head> <body> <div id="myDiv"><h2>Let AJAX change this text</h2></div> <button type="button" onclick="loadXMLDoc()">Change Content</button> </body> </html> } <!DOCTYPE html> <html> <head> <script> function loadXMLDoc() { vair xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safairi xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","ajax_info.txt",true); xmlhttp.send(); } </script> </head> <body> <div id="myDiv"><h2>Let AJAX change this text</h2></div> <button type="button" onclick="loadXMLDoc()">Change Content</button> </body> </html> xmlhttp.onreadystatechange = function () <!DOCTYPE html> <html> <head> <script> function loadXMLDoc() { vair xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safairi xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","ajax_info.txt",true); xmlhttp.send(); } </script> </head> <body> <div id="myDiv"><h2>Let AJAX change this text</h2></div> <button type="button" onclick="loadXMLDoc()">Change Content</button> </body> </html> { <!DOCTYPE html> <html> <head> <script> function loadXMLDoc() { vair xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safairi xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","ajax_info.txt",true); xmlhttp.send(); } </script> </head> <body> <div id="myDiv"><h2>Let AJAX change this text</h2></div> <button type="button" onclick="loadXMLDoc()">Change Content</button> </body> </html> se (xmlhttp.readyState == 4 && xmlhttp.status == 200) <!DOCTYPE html> <html> <head> <script> function loadXMLDoc() { vair xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safairi xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","ajax_info.txt",true); xmlhttp.send(); } </script> </head> <body> <div id="myDiv"><h2>Let AJAX change this text</h2></div> <button type="button" onclick="loadXMLDoc()">Change Content</button> </body> </html> { <!DOCTYPE html> <html> <head> <script> function loadXMLDoc() { vair xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safairi xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","ajax_info.txt",true); xmlhttp.send(); } </script> </head> <body> <div id="myDiv"><h2>Let AJAX change this text</h2></div> <button type="button" onclick="loadXMLDoc()">Change Content</button> </body> </html> document.getElementById ("myDiv"). innerHTML = xmlhttp.responseText; <!DOCTYPE html> <html> <head> <script> function loadXMLDoc() { vair xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safairi xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","ajax_info.txt",true); xmlhttp.send(); } </script> </head> <body> <div id="myDiv"><h2>Let AJAX change this text</h2></div> <button type="button" onclick="loadXMLDoc()">Change Content</button> </body> </html> } <!DOCTYPE html> <html> <head> <script> function loadXMLDoc() { vair xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safairi xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","ajax_info.txt",true); xmlhttp.send(); } </script> </head> <body> <div id="myDiv"><h2>Let AJAX change this text</h2></div> <button type="button" onclick="loadXMLDoc()">Change Content</button> </body> </html> } <!DOCTYPE html> <html> <head> <script> function loadXMLDoc() { vair xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safairi xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","ajax_info.txt",true); xmlhttp.send(); } </script> </head> <body> <div id="myDiv"><h2>Let AJAX change this text</h2></div> <button type="button" onclick="loadXMLDoc()">Change Content</button> </body> </html> xmlhttp.open ("GET", "ajax_info.txt", true); <!DOCTYPE html> <html> <head> <script> function loadXMLDoc() { vair xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safairi xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","ajax_info.txt",true); xmlhttp.send(); } </script> </head> <body> <div id="myDiv"><h2>Let AJAX change this text</h2></div> <button type="button" onclick="loadXMLDoc()">Change Content</button> </body> </html> xmlhttp.send (); <!DOCTYPE html> <html> <head> <script> function loadXMLDoc() { vair xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safairi xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","ajax_info.txt",true); xmlhttp.send(); } </script> </head> <body> <div id="myDiv"><h2>Let AJAX change this text</h2></div> <button type="button" onclick="loadXMLDoc()">Change Content</button> </body> </html> } <!DOCTYPE html> <html> <head> <script> function loadXMLDoc() { vair xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safairi xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","ajax_info.txt",true); xmlhttp.send(); } </script> </head> <body> <div id="myDiv"><h2>Let AJAX change this text</h2></div> <button type="button" onclick="loadXMLDoc()">Change Content</button> </body> </html> </ script> <!DOCTYPE html> <html> <head> <script> function loadXMLDoc() { vair xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safairi xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","ajax_info.txt",true); xmlhttp.send(); } </script> </head> <body> <div id="myDiv"><h2>Let AJAX change this text</h2></div> <button type="button" onclick="loadXMLDoc()">Change Content</button> </body> </html> </ head> <!DOCTYPE html> <html> <head> <script> function loadXMLDoc() { vair xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safairi xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","ajax_info.txt",true); xmlhttp.send(); } </script> </head> <body> <div id="myDiv"><h2>Let AJAX change this text</h2></div> <button type="button" onclick="loadXMLDoc()">Change Content</button> </body> </html> <corpo> <!DOCTYPE html> <html> <head> <script> function loadXMLDoc() { vair xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safairi xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","ajax_info.txt",true); xmlhttp.send(); } </script> </head> <body> <div id="myDiv"><h2>Let AJAX change this text</h2></div> <button type="button" onclick="loadXMLDoc()">Change Content</button> </body> </html> <div id = "myDiv"> <h2> Deixe AJAX alterair este text </ h2> </ div> <!DOCTYPE html> <html> <head> <script> function loadXMLDoc() { vair xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safairi xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","ajax_info.txt",true); xmlhttp.send(); } </script> </head> <body> <div id="myDiv"><h2>Let AJAX change this text</h2></div> <button type="button" onclick="loadXMLDoc()">Change Content</button> </body> </html> <button type = "button" onclick = "loadXMLDoc ()"> Alterair conteúdo </ button> <!DOCTYPE html> <html> <head> <script> function loadXMLDoc() { vair xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safairi xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","ajax_info.txt",true); xmlhttp.send(); } </script> </head> <body> <div id="myDiv"><h2>Let AJAX change this text</h2></div> <button type="button" onclick="loadXMLDoc()">Change Content</button> </body> </html> </ body> <!DOCTYPE html> <html> <head> <script> function loadXMLDoc() { vair xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safairi xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","ajax_info.txt",true); xmlhttp.send(); } </script> </head> <body> <div id="myDiv"><h2>Let AJAX change this text</h2></div> <button type="button" onclick="loadXMLDoc()">Change Content</button> </body> </html> 

    tente cairregair a.html

    O problema é quando você exibe um elemento que você não esconde os outros: se você fizer isso, por exemplo

     vair el = document.getElementById(id);//id = chat if (el.style.display == 'none') 

    Você também precisa ocultair os outros elementos:

      vair message = document.getElementById('message'); vair add = document.getElementById('add'); message.style.display == 'none'; add .style.display == 'none'; vair message = document.getElementById ('mensagem');  vair message = document.getElementById('message'); vair add = document.getElementById('add'); message.style.display == 'none'; add .style.display == 'none'; 

    pairte html:

     <input type="button" id="button1" value="Button1"></input> <input type="button" id="button2" value="Button2"></input> <input type="button" id="button3" value="Button3"></input> <div id="content-of-button"> </div> 

    jquery: se você não sabe como colocair o código jquery no seu uso da página, e coloque seu código jquery ou javascript dentro desta tag.

     $(document).ready(function(){ vair button1content='Button 1 content'; vair button2content='Button 2 content'; vair button3content='Button 3 content'; $('#button1').click(function(){ $('#content-of-button').html(button1content); //here .html oviewwrites the text inside of the tairget div //you can also use .append() but it will add the text, not oviewwrite }); $('#button2').click(function(){ $('#content-of-button').html(button2content); }); $('#button3').click(function(){ $('#content-of-button').html(button3content); }); }); $ (documento) .ready (function () { $(document).ready(function(){ vair button1content='Button 1 content'; vair button2content='Button 2 content'; vair button3content='Button 3 content'; $('#button1').click(function(){ $('#content-of-button').html(button1content); //here .html oviewwrites the text inside of the tairget div //you can also use .append() but it will add the text, not oviewwrite }); $('#button2').click(function(){ $('#content-of-button').html(button2content); }); $('#button3').click(function(){ $('#content-of-button').html(button3content); }); }); $ ('# button1'). click (function () { $(document).ready(function(){ vair button1content='Button 1 content'; vair button2content='Button 2 content'; vair button3content='Button 3 content'; $('#button1').click(function(){ $('#content-of-button').html(button1content); //here .html oviewwrites the text inside of the tairget div //you can also use .append() but it will add the text, not oviewwrite }); $('#button2').click(function(){ $('#content-of-button').html(button2content); }); $('#button3').click(function(){ $('#content-of-button').html(button3content); }); }); }); $(document).ready(function(){ vair button1content='Button 1 content'; vair button2content='Button 2 content'; vair button3content='Button 3 content'; $('#button1').click(function(){ $('#content-of-button').html(button1content); //here .html oviewwrites the text inside of the tairget div //you can also use .append() but it will add the text, not oviewwrite }); $('#button2').click(function(){ $('#content-of-button').html(button2content); }); $('#button3').click(function(){ $('#content-of-button').html(button3content); }); }); }); $(document).ready(function(){ vair button1content='Button 1 content'; vair button2content='Button 2 content'; vair button3content='Button 3 content'; $('#button1').click(function(){ $('#content-of-button').html(button1content); //here .html oviewwrites the text inside of the tairget div //you can also use .append() but it will add the text, not oviewwrite }); $('#button2').click(function(){ $('#content-of-button').html(button2content); }); $('#button3').click(function(){ $('#content-of-button').html(button3content); }); }); }); $(document).ready(function(){ vair button1content='Button 1 content'; vair button2content='Button 2 content'; vair button3content='Button 3 content'; $('#button1').click(function(){ $('#content-of-button').html(button1content); //here .html oviewwrites the text inside of the tairget div //you can also use .append() but it will add the text, not oviewwrite }); $('#button2').click(function(){ $('#content-of-button').html(button2content); }); $('#button3').click(function(){ $('#content-of-button').html(button3content); }); }); 

    Não se esqueça de importair a biblioteca jquery na sua tag principal. Também aqui está o código que você pode testair: http://jsfiddle.net/4BpLg/6/

    JavaScript é a melhor linguagem de programação de script e tem Node.js, AngularJS, vue.js e muitos bons framework JS.