Jump to content

Not Working In Ie7?


tinfanide

Recommended Posts

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Online Exercise</title><script>function checkBrowserVersion(){if(navigator.appVersion.indexOf("MSIE 7.")!=-1){  alert("You're using Internet Explorer 7. Sorry! This page cannot be processed in Internet Explorer 7. You may use Firefox or Internet Explorer 8 or above.");  }}function parseXML(method,xml,async){if(window.XMLHttpRequest){  xmlhttp = new XMLHttpRequest();  xmlhttp.open(method,xml,async);  xmlhttp.send();  }else {  xmlhttp = new ActiveXObject("Microsoft.XMLHTTP") ;  xmlhttp.async=async;  xmlhttp.load(xml);  }xmlDoc = xmlhttp.responseXML;}parseXML("GET","answers.xml",false);function setQuestions(){for(var i=0; i<xmlDoc.getElementsByTagName("assessment").length; i++){  var paper = document.createElement("form");  paper.name = "";   document.body.appendChild(paper);    var ques = document.createElement("p");   ques.id = "ques"+xmlDoc.getElementsByTagName("assessment")[i].getAttribute("id");  ques.innerHTML = "Q"+xmlDoc.getElementsByTagName("assessment")[i].getAttribute("id") + ". " + xmlDoc.getElementsByTagName("assessment")[i].getAttribute("question");   paper.appendChild(ques);    var input = document.createElement("input");  input.setAttribute("type","text");  input.id = "input" + xmlDoc.getElementsByTagName("assessment")[i].getAttribute("id");   paper.appendChild(input);    var check = document.createElement("input");  check.setAttribute("type","button");  check.setAttribute("value","Check");  check.setAttribute("onclick","checkAnswers(" +  xmlDoc.getElementsByTagName("assessment")[i].getAttribute("id") + ")");   paper.appendChild(check);    var ans = document.createElement("label");  ans.id = "ans" + xmlDoc.getElementsByTagName("assessment")[i].getAttribute("id");   paper.appendChild(ans);  } } function checkAnswers(q){if(document.getElementById("input"+q).value == xmlDoc.getElementsByTagName("assessment")[q-1].getAttribute("answer")){  document.getElementById("ans"+q).innerHTML = "  " + "Correct";  document.getElementById("ans"+q).style.color = "green";  } else {   document.getElementById("ans"+q).innerHTML = "  " + "Wrong!"   document.getElementById("ans"+q).style.color = "red";   }} window.onload = function(){setQuestions();checkBrowserVersion();}</script></head><body></body></html>

IE Developer Tool does not tell me why it does not work in IE7.It doesn't return the answers.But it works in IE8 and 9.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...