Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Ola pessoal, estou com problemas com o IE9.
O script funcioma bem para o chrome e o firefox, mas pra variar o IE tinha que dar o ar da graça.
Se alguem souber me ajudar, la vai o script:
no forum ha um botao em que o pessoal agradece o post.
echo "<script src=\"https://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js\"></script><script type='text/javascript' src='scripts/thanks.js'></script>";
?>
<script type="text/javascript">
function thanks_ajax() {
new Ajax.Request('thanks.php',
{
'method': 'post',
parameters: { 'topico': '<?=$id?>' },
onCreate: function() { $('thanks_response').update('processando..'); },
onSuccess: function(t) {
if (Prototype.Browser.IE) {
try //Internet Explorer (stupid browser)
{
t.responseXML=new ActiveXObject("Microsoft.XMLDOM");
t.responseXML.async="false";
t.responseXML.loadXML(t.responseText);
}
catch(e)
{
$('thanks_response').update('XML error: '+e.message);
return;
}
}
objthanks = t.responseXML.firstChild.getElementsByTagName('thanks');
objresponse = t.responseXML.firstChild.getElementsByTagName('response');
if (objthanks.length == 0 || objresponse.length == 0)
{
$('thanks_response').update('XML error');
return;
}
$('thanks').update(objthanks[0].firstChild.nodeValue);
$('thanks_response').update(objresponse[0].firstChild.nodeValue);
},
onFailure: function() { $('thanks_response').update('Ajax error'); }
});
}
</script>
<?php
if (!$leftthanks) print("<tr><td align=\"left\"> </td><td><div id=\"thanks_response\"><input type=\"button\" OnClick=\"thanks_ajax();\" value=\"Obrigado!\"></td></tr>\n");
thanks.js
function leavethanks (id) {
id = parseInt(id);
new Ajax.Request('thanks_ajax.php', {method: 'get', parameters: 'topico='+id, onSuccess:function (t) { document.getElementById('thanksdiv_add').innerHTML = t.responseText; }});
new Ajax.Request('thanks_ajax.php', {method: 'get', parameters: 'display=1&topico='+id, onSuccess:function (t) { document.getElementById('thanksdiv').innerHTML = t.responseText; }});
document.thanksform.submit.disabled = true;
}
thanks_ajax.php
<?php
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
require_once("funct.php");
dbconn(false);
if (!$usu) die;
$id = (int)$_GET['topico'];
if (!is_valid_id($id)) die;
$res = mysql_query("SELECT `THANKS` FROM TB_THANKS WHERE ID=$id");
$row = mysql_fetch_assoc($res);
mysql_free_result($res);
if (!$row) die;
$thanksl = explode(",", $row['THANKS']);
$thanks = "";
if ($_GET["display"] == 1) {
foreach ($thanksl as $u) {
$thanks .= ($i>0)?", $u":$u;
$i++;
}
if (!$thanks)
$thanks = "Nenhum ainda.";
die($thanks);
}
if (in_array($usu['username'], $thanksl)) die("Você já agradeceu neste topico.");
mysql_query(sprintf("UPDATE `TB_THANKS` SET THANKS = CONCAT_WS(',', `thanks`, %s) WHERE `id`=%d", sqlesc($usu['username']), $id)) or die(mysql_error());
echo "Agradecimento adicionado!.";
?>
O unico problema que acontece no FF e no chrome, é que quando ha muitos agradecimentos, e eu, por exemplo vou la agradecer, a tela estoura na largura...
Mas so me ajudando com o problema de fazer funcionar no IE ja ta bao d+
abraçao
Carregando comentários...