בעיה | שגיאה רק ב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;
}
}
|