Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [advAJAX] 2 Problemy
Smeagol
post
Post #1





Grupa: Zarejestrowani
Postów: 1
Pomógł: 0
Dołączył: 13.08.2006

Ostrzeżenie: (0%)
-----


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:
  1. function $(id) {
  2.  
  3. return document.getElementById(id);
  4. }
  5.  
  6. function parseRecords(xml) {
  7.  
  8. record = xml.getElementsByTagName("record");
  9. result = "";
  10.  
  11. with (xml.getElementsByTagName("records").item(0)) {
  12.  
  13. $("d").innerHTML = "";
  14. }
  15.  
  16. for ( j=0; j<record.length; j++ )
  17. {
  18. tr = document.createElement("tr");
  19.  
  20. for ( i=0; i<record[j].childNodes.length; i++ )
  21. {
  22. if(record[j].childNodes[i].hasChildNodes()) {
  23. td = document.createElement("td");
  24. td.innerHTML = record[j].childNodes[i].childNodes[0].nodeValue;
  25. tr.appendChild(td);
  26. }
  27. }
  28. d.appendChild(tr);
  29. }
  30. return result;
  31. }
  32.  
  33. function getRecords(t) {
  34.  
  35.  
  36. advAJAX.get({
  37.  
  38. url : "test.php",
  39. parameters:{
  40. t: t,
  41.  
  42. },
  43. onInitialization : function() {
  44.  
  45. $("d").innerHTML = 'Pobieranie danych...';
  46.  
  47. },
  48. onSuccess : function(obj) {
  49.  
  50. parseRecords(obj.responseXML);
  51. }
  52. });
  53. }

Kod:
  1.  
  2. <meta http-equiv="Content-Language" content="pl">
  3. <meta http-equiv="Content-Type" content="text/html; charset=windows-1250">
  4. <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
  5. <meta name="ProgId" content="FrontPage.Editor.Document">
  6. <title>New Page 1</title>
  7. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  8. <script type="text/javascript" src="advajax.js"></script>
  9. <script type="text/javascript" src="2.js"></script>
  10. </head>
  11. </head>
  12.  
  13.  
  14. <table border="0" cellpadding="0" cellspacing="0" width="100%" height="1">
  15. <tr>
  16. <td width="36%" valign="top" height="1">
  17. <table border="0" cellpadding="0" cellspacing="0" width="100%">
  18. <tr>
  19. <td width="100%">
  20. <a href="java script:getRecords('165')">mecz2</a><br>
  21. <a href="java script:getRecords('163')">mecz3</a>
  22. </td>
  23. </tr>
  24. </table>
  25. </td>
  26. <td width="36%" valign="top" height="1">
  27. <table border="0" cellpadding="0" cellspacing="0" width="100%">
  28. <tr>
  29. <td width="100%">
  30. <table cellpadding="1" cellspacing="1">
  31.  
  32. <tbody id="d">
  33.  
  34. </td>
  35. </tr>
  36. </table>
  37. </td>
  38. </tr>


Kod:
  1. <?
  2. header("Content-type: text/xml; charset=UTF-8"); 
  3.  
  4.  
  5.  
  6. include "config.inc.php";
  7.  
  8.  
  9. $conn = mysql_connect($server, $identyfikator, $haslo)
  10. or die ("Nie udało się połączyć z bazą danych!");
  11. or die ("Nie udało się wybrać bazy!");
  12.  
  13.  
  14. $query="SELECT * FROM towar2 WHERE id_towaru2='$t'";
  15. $result = mysql_query($query);
  16.  
  17. $i=1;
  18.  
  19.  
  20. echo '<?xml version="1.0" encoding="UTF-8"?><records>';
  21.  while ($row = mysql_fetch_assoc($result)){
  22. echo '<record>';
  23. echo '<name>';
  24.  echo $row["id_towaru2"];
  25. echo '</name>';
  26. echo '<surname>';
  27.  echo $row["zdarzenie2"];
  28. echo '</surname>';
  29. echo '<telephone>';
  30.  echo $row["datarozpoczecia2"];
  31. echo '</telephone>';
  32. echo '<telephone2>';
  33.  echo $row["kurs12"];
  34. echo '</telephone2>';
  35. echo '</record>';
  36. }
  37.  echo '</records>';
  38.  
  39. ?>




i link do dzialajacego skryptu pod firexoks

http://sport.nazwa.pl/ajax/
Go to the top of the page
+Quote Post

Posty w temacie
- Smeagol   [advAJAX] 2 Problemy   13.08.2006, 12:02:37
- - TomASS   ad 1.: skąd ten biedy IE ma wiedzieć co to jest ...   13.08.2006, 21:51:52


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 23.08.2025 - 18:11