![]() |
# 1 |
חבר וותיק
|
בעיה | שגיאה רק ב6 בajax
שלום אני משתגע ויושב על זה כבר שעות יש בעיה רק בIE ושהאג'קס רצה השיגאה document doesnt support this property or method מופיעה בשורת השגיאה של אקפלורר והוא לא פועלת ואילו רק שעושים רענן היא פועלת מצויין ובFF אין בכל בכלל בעיות
אשמח אם משהו יכול לפתור לי את זה אפילו עם תמורה . תודה ושוב תוודה! חלקי קוד הרלבנטיים(HTML): HTML קוד:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html dir="rtl" xmlns="http://www.w3.org/1999/xhtml" lang="he"> <head> <script language="javascript" src="functions.js" type=""> </script> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <link rel="stylesheet" href="skin.css" type="text/css" /> <title>Imlaugh</title> </head> <body onload="body_load();"> <form name="mycomment" class="comment" action="javascript: add_comment();"> שם מלא<br /><input type="text" name="name" id="name" class="typs"/> תוכן התגובה<br /><textarea class="content" name="comment" id="comment"></textarea> <input class="send" name="submit" type="submit" value="שלח תגובה" align="left" onclick="javascript: sendRequest();"/> </form> קובץ הגאווה סקריפט קוד:
function createXMLHttpRequest() { var ua; if(window.XMLHttpRequest) { try { ua = new XMLHttpRequest(); } catch(e) { ua = false; } } else if(window.ActiveXObject) { try { ua = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { ua = false; } } return ua; } //add comment function add_comment() { document.getElementById("alert").style.display="inline"; a=document.getElementById("name").value; b=document.getElementById("comment").value; if (a !=="" || b!=="") { document.getElementById("add_comment").style.display="none"; } req.open("Get", "add_comment.php?name="+a+"&comment="+b); req.onreadystatechange = handleResponse; req.send(null); } XMLHttpRequest function handleResponse() { if(req.readyState == 4) { var response = req.responseText; document.getElementById("alert").innerHTML = response; } body_load() } //called to comments function body_load() { req2.open("Get", "comments.php?id=3"); req2.onreadystatechange = handleResponse2; req2.send(null); } XMLHttpRequest function handleResponse2() { if(req2.readyState == 4) { var response = req2.responseText; document.getElementById("comment_sent").innerHTML = response; } } |
![]() |
![]() |
# 2 |
משתמש - היכל התהילה
|
היי,
תחליף את: קוד:
function createXMLHttpRequest() { var ua; if(window.XMLHttpRequest) { try { ua = new XMLHttpRequest(); } catch(e) { ua = false; } } else if(window.ActiveXObject) { try { ua = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { ua = false; } } return ua; } קוד:
function getXMLHttp() { var ua; try { //Firefox, Opera 8.0+, Safari ua = new XMLHttpRequest(); } catch(e) { //Internet Explorer try { ua = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try { ua = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { return false; } } } return ua; } |
![]() |
![]() |
# 3 |
חבר וותיק
|
תודה ידידי! החםלתי את הקידוד של הקובץ PHP וזה הסתדר איזה דפוק זה.
הוספתי גם את הקוד שלך וזה דווקא עובד עם כל הקידודים שהגדרתי. תודה רבה על העזרה ![]() |
![]() |
![]() |
חברים פעילים הצופים באשכול זה: 1 (0 חברים ו- 1 אורחים) | |
|
|