Witam,
2 pytania:
Dlaczego nie działa pod IE
Dlaczego po klikniecie na link obniża wyświetlane dane o jeden enter
oto kod:
Kod:
function $(id) {
return document.getElementById(id);
}
function parseRecords(xml) {
record = xml.getElementsByTagName("record");
result = "";
with (xml.getElementsByTagName("records").item(0)) {
$("d").innerHTML = "";
}
for ( j=0; j<record.length; j++ )
{
tr = document.createElement("tr");
for ( i=0; i<record[j].childNodes.length; i++ )
{
if(record[j].childNodes[i].hasChildNodes()) {
td = document.createElement("td");
td.innerHTML = record[j].childNodes[i].childNodes[0].nodeValue;
tr.appendChild(td);
}
}
d.appendChild(tr);
}
return result;
}
function getRecords(t) {
advAJAX.get({
url : "test.php",
parameters:{
t: t,
},
onInitialization : function() {
$("d").innerHTML = 'Pobieranie danych...';
},
onSuccess : function(obj) {
parseRecords(obj.responseXML);
}
});
}
Kod:
<meta http-equiv="Content-Language" content="pl"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1250"> <meta name="GENERATOR" content="Microsoft FrontPage 4.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<table border="0" cellpadding="0" cellspacing="0" width="100%" height="1"> <td width="36%" valign="top" height="1"> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <a href="java script:getRecords('165')">mecz2
</a><br> <a href="java script:getRecords('163')">mecz3
</a> <td width="36%" valign="top" height="1"> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <table cellpadding="1" cellspacing="1">
Kod:
<?
header("Content-type: text/xml; charset=UTF-8");
include "config.inc.php";
or
die ("Nie udało się połączyć z bazą danych!"); or
die ("Nie udało się wybrać bazy!");
$query="SELECT * FROM towar2 WHERE id_towaru2='$t'";
$i=1;
echo '<?xml version="1.0" encoding="UTF-8"?><records>'; echo $row["datarozpoczecia2"]; }
?>
i link do dzialajacego skryptu pod firexoks
http://sport.nazwa.pl/ajax/