Abs
Edição feita por: guimafx, 27/06/2006, 15:54.
Posted 27/06/2006, 15:47
Edição feita por: guimafx, 27/06/2006, 15:54.
Posted 28/06/2006, 17:23
<script language="javascript">
function openAjax() {
var Ajax;
try {Ajax = new XMLHttpRequest(); // XMLHttpRequest para browsers mais populares, como: Firefox, Safari, dentre outros.
}catch(ee) {
try {Ajax = new ActiveXObject("Msxml2.XMLHTTP"); // Para o IE da MS
}catch(e) {
try {Ajax = new ActiveXObject("Microsoft.XMLHTTP"); // Para o IE da MS
}catch(e) {Ajax = false;
}
}
}
return Ajax;
}
function carregaAjax(id,pagina) {
if(document.getElementById) { // Para os browsers complacentes com o DOM W3C.
var exibeResultado = document.getElementById(id); // div que exibirá o resultado.
var Ajax = openAjax(); // Inicia o Ajax.
Ajax.open("GET", pagina, true); // fazendo a requisição
Ajax.onreadystatechange = function()
{
if(Ajax.readyState == 1) { // Quando estiver carregando, exibe: carregando...
exibeResultado.innerHTML = "<div align=’center’><strong>Carregando...</strong></div>";
}
if(Ajax.readyState == 4) { // Quando estiver tudo pronto.
if(Ajax.status == 200) {
var resultado = Ajax.responseText; // Coloca o retornado pelo Ajax nessa variável
resultado = resultado.replace(/\+/g," "); // Resolve o problema dos acentos (saiba mais aqui: http://www.plugsites.net/leandro/?p=4)
resultado = unescape(resultado); // Resolve o problema dos acentos
exibeResultado.innerHTML = resultado;
} else {
exibeResultado.innerHTML = "Erro: .";
}
}
}
Ajax.send(null); // submete
}
}
</script>
<li><a href="java script:carregaAjax('conteudo','teste.html')">History</a></li>
Edição feita por: mestre fyoda, 28/06/2006, 17:27.
Posted 30/06/2006, 12:15
Posted 30/06/2006, 15:04
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR...nsitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pt-br"
lang="pt-br">
Posted 10/07/2006, 13:37
echo urlencode('BláBláBlá');
var texto = xmlHttp.responseText; texto=texto.replace(/\+/g," "); texto=unescape(texto); document.getElementById('NomeDaDIV').innerHTML=texto;
Posted 10/07/2006, 13:55
Posted 10/07/2006, 14:02
Posted 17/07/2006, 23:27
Tambem, estou com o mesmo problema, em recuperar os dado do Segundo COMBOTudo funcionou perfeitamente ao que o tutorial se propos, mas estou com um pequeno problema.
Preciso gravar os valores dos dois combos em um BD, ou seja, recuperar via POST ou GET estes valores.
O primeiro combo deu pra recuperar tranquilamente já o segundo não.
Como recuperar o valor do combo2 ?
Alguem, pode nos dar uma luz?
Posted 04/08/2006, 11:48
<?php clearstatcache(); session_start(); ignore_user_abort(true); require('variaveis.inc.php'); require('funcoes.inc.php'); include "dbconnect.php"; ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script language="javascript"> function pesquisar_dados( valor ) { http.open("GET", "consultar.php?id=" + valor, true); http.onreadystatechange = handleHttpResponse; http.send(null); } function handleHttpResponse() { campo_select = document.forms[0].subcategoria; if (http.readyState == 4) { campo_select.options.length = 0; results = http.responseText.split(","); for( i = 0; i < results.length; i++ ) { string = results[i].split( "|" ); campo_select.options[i] = new Option( string[0], string[1] ); } } } function getHTTPObject() { var xmlhttp; /*@cc_on @if (@_jscript_version >= 5) try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { xmlhttp = false; } } @else xmlhttp = false; @end @*/ if (!xmlhttp && typeof XMLHttpRequest != 'undefined') { try { xmlhttp = new XMLHttpRequest(); } catch (e) { xmlhttp = false; } } return xmlhttp; } var http = getHTTPObject(); </script> </head> <body> <form name="formulario" method="post" action=""> <p><select name="categoria" onchange="pesquisar_dados( this.value )"> <option></option> <?php $consulta = mysql_query("SELECT * FROM categorias ORDER BY nome ASC"); while( $row = mysql_fetch_assoc($consulta) ) { echo "<option value=\"{$row['codigo']}\">{$row['nome']}</option>\n"; } ?> </select></p> <p><select name="subcategoria"></select></p> <option></option> </form> </body> </html>
Posted 09/10/2006, 23:31
Posted 07/12/2006, 19:36
E se eu quisesse apenas fazer um INSERT ou um DELETE como ficaria?
Posted 09/12/2006, 00:08
Posted 05/01/2007, 08:59
Edição feita por: Marcos de Paula Muniz, 05/01/2007, 09:01.
Posted 11/01/2007, 11:46
<html> <head> <title>Sample Page</title> <script language="JavaScript" type="text/javascript"> var intervalId; var counter2=0; var counter3=0; function NeverEnding(input) { document.getElementById('result2').innerHTML=counter2; if(counter2==5){ counter3=counter3+counter2; document.getElementById('result3').innerHTML=counter3; counter2=0; } counter2 ++; if(counter2>=5) { window.cleanrInterval(intervalId); } } function StartItNonEnding() { intervalId=window.setInterval(NeverEnding,1000,10); } </script> </head> <body onLoad="StartItNonEnding()"> <table border="1"> <tr> <td> Contador 1 </td> <td> <span id="result2"> </span> </td> </tr> <tr> <td> Contador 2 </td> <td> <span id="result3"> </span> </td> </tr> </table> </body> </html>
Posted 05/02/2007, 12:29
0 membro(s), 0 visitante(s) e 0 membros anônimo(s)