help! I dont have IE6 and apparently it aint working

Discussion in 'Javascript' started by windandwaves, Dec 10, 2006.

  1. windandwaves

    windandwaves Guest

    Hi Folk

    Can you please have a look at http://www.friars.co.nz/map.php and let
    me know if the map is working on IE6 (just do a simple search).
    Unfortunately, I do not have IE6 anymore and so I can not test it.

    I think there maybe some trouble with retrieving the AJAX xml. Below
    is the code for this:

    var i = new Array();
    var j = 0;
    var jmax = 4;
    var http_request = false;


    Thanks a million

    Nicolaas

    //------------------------------------ Main functions
    //main function to chang the map
    function changemap() {
    var variables = getformparameters(document.getElementById('mapform'),
    '')+ "&h=1&k=1&l=1&m=1";
    var onready = "updatemap";
    UpdateHtml('_GSmap.php', 'GSmaptype=8' + variables, onready);
    //initMapGSmap();
    createGSlayer('GSmaptype=1' + variables);
    //reset
    j = 0;
    i = new Array();

    return true;
    }

    // run a search (prior to updating the map)
    function getsearchdata() {
    var variables = getformparameters(document.getElementById('sea'), '');
    variables = variables + "&map=1";
    var el = document.getElementById('c2');
    el.checked = true;
    var el = document.getElementById('syes');
    el.checked = true;
    var onready = "updatesearchresults";
    var url = "searcher.php";
    UpdateHtml(url, variables, onready);
    return true;
    }

    //------------------------------------ FORM interaction

    //gets all variables from a form
    function getformparameters(obj, getstr) {
    j++;
    for (i[j]=0; i[j] < obj.childNodes.length; i[j]++) {
    var newobj = obj.childNodes[i[j]];
    tgname = newobj.tagName
    if(tgname) {
    tgname.toLowerCase;
    if (tgname == "INPUT") {
    var tvalue = newobj.value;
    if(tvalue != 0 && tvalue != "") {
    var ttype = newobj.type;
    var tname = newobj.name;
    if (ttype == "text") {
    getstr += "&" + tname + "=" + tvalue ;
    }
    if (ttype == "checkbox") {
    if (newobj.checked) {
    getstr += "&" + tname + "=" + tvalue;
    }
    else {
    getstr += "&" + tname + "=0";
    }
    }
    if (ttype == "radio") {
    if (newobj.checked) {
    getstr += "&" + tname + "=" + tvalue;
    }
    }
    }
    }
    if (tgname == "SELECT") {
    var sel = newobj;
    var tvalue = sel.options[sel.selectedIndex].value;
    if(tvalue != 0 && tvalue != "") {
    getstr += "&" + sel.name + "=" + tvalue;
    }
    }
    }
    if(newobj.childNodes.length > 0 && j < jmax) {
    getstr = getformparameters(newobj, getstr);
    }
    }

    j--;
    return getstr;
    }

    //------------------------------------ AJAX STARTER
    //open xml sheet on the server and specify the function to run when the
    xml is loaded
    function UpdateHtml(url, parameters, onready) {
    http_request = false;
    if (window.XMLHttpRequest) { // Mozilla, Safari,...
    http_request = new XMLHttpRequest();
    if (http_request.overrideMimeType) {
    // set type accordingly to anticipated content type
    http_request.overrideMimeType('text/xml');
    //http_request.overrideMimeType('text/html');
    }
    }
    else if (window.ActiveXObject) { // IE
    try {
    http_request = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e) {
    try {
    http_request = new ActiveXObject("Microsoft.XMLHTTP");
    }
    catch (e) {
    alert('could not load data');
    }
    }
    }
    if (!http_request) {
    alert('Cannot create XMLHTTP instance');
    return false;
    }
    if(onready == "updatemap") {
    http_request.onreadystatechange = updatemap;
    }
    else {
    http_request.onreadystatechange = updatesearchresults;
    }
    var geturl = url + '?' + parameters;
    document.getElementById(idname + 'title').innerHTML = "loading new map
    .... "; //+ geturl;
    http_request.open('GET', geturl, true);
    http_request.async = false;
    http_request.send(null);
    }

    // -------------- process XML ----------------------------
    //process map data
    function updatemap() {
    if (http_request.readyState == 4) {
    if (http_request.status == 200) {
    //alert(http_request.responseText);
    var xmlDoc = http_request.responseXML;
    var titlearray = xmlDoc.getElementsByTagName('title');
    var infoarray = xmlDoc.getElementsByTagName('info');
    var zoomarray = xmlDoc.getElementsByTagName('zoom');
    var longitudearray = xmlDoc.getElementsByTagName('longitude');
    var lattitudearray = xmlDoc.getElementsByTagName('lattitude');
    var info = serializeNode(infoarray[0]);
    var a = lattitudearray[0].firstChild.nodeValue;
    var o = longitudearray[0].firstChild.nodeValue;
    var z = zoomarray[0].firstChild.nodeValue;
    if(document.getElementById(idname + 'title')) {
    document.getElementById(idname + 'title').innerHTML =
    titlearray[0].firstChild.nodeValue;
    }
    if (document.getElementById(idname + 'info') && 1 == 2) {
    document.getElementById(idname + 'info').innerHTML = info;
    }
    if(document.getElementById('outerinfo')) {
    document.getElementById('outerinfo').innerHTML = '' + info + '';
    }
    GSrezoom(o,a,z);
    }
    else {
    alert('There was a problem with the request.');
    }
    }
    else {

    }
    }

    //process search results
    function updatesearchresults() {
    if (http_request.readyState == 4) {
    if (http_request.status == 200) {
    var xmlDoc = http_request.responseXML;
    var humansqlarray = xmlDoc.getElementsByTagName('humansql');
    var humansql = serializeNode(humansqlarray[0]);
    document.getElementById('humansql').innerHTML = humansql;
    changemap();
    }
    else {
    alert('There was a problem with the request.');
    }
    }
    }

    // -------------- XML details ----------------------------
    //retrieve data from XML sheet
    function serializeNode(node) {
    if(node != undefined) {
    var xml = "";
    if(_browser.isSafari) {
    xml = xmlText(node);
    }
    else if(_browser.isIE) {
    xml = node.xml;
    }
    else {
    var serializer = new XMLSerializer();
    xml = serializer.serializeToString(node);
    }
    return xml;
    }
    else {
    return undefined;
    }
    }

    var DOM_ELEMENT_NODE = 1;
    var DOM_TEXT_NODE = 3;


    /**
    * Returns the representation of a node as XML text.
    */
    function xmlText(node) {
    var ret = '';
    if (node.nodeType == DOM_TEXT_NODE) {
    ret += node.nodeValue;
    }
    else if (node.nodeType == DOM_ELEMENT_NODE) {
    ret += '<' + node.nodeName;
    for (var i = 0; i < node.attributes.length; ++i) {
    var a = node.attributes;
    if (a && a.nodeName && a.nodeValue) {
    ret += ' ' + a.nodeName;
    ret += '="' + a.nodeValue + '"';
    }
    }
    if (node.childNodes.length == 0) {
    ret += '/>';
    }
    else {
    ret += '>';
    for (var i = 0; i < node.childNodes.length; ++i) {
    ret += arguments.callee(node.childNodes);
    }
    ret += '</' + node.nodeName + '>';
    }
    }
    return ret;
    }
     
    windandwaves, Dec 10, 2006
    #1
    1. Advertising

  2. windandwaves

    Daz Guest

    windandwaves wrote:

    > Hi Folk
    >
    > Can you please have a look at http://www.friars.co.nz/map.php and let
    > me know if the map is working on IE6 (just do a simple search).
    > Unfortunately, I do not have IE6 anymore and so I can not test it.
    >
    > I think there maybe some trouble with retrieving the AJAX xml. Below
    > is the code for this:
    >
    > var i = new Array();
    > var j = 0;
    > var jmax = 4;
    > var http_request = false;
    >
    >
    > Thanks a million
    >
    > Nicolaas
    >
    > //------------------------------------ Main functions
    > //main function to chang the map
    > function changemap() {
    > var variables = getformparameters(document.getElementById('mapform'),
    > '')+ "&h=1&k=1&l=1&m=1";
    > var onready = "updatemap";
    > UpdateHtml('_GSmap.php', 'GSmaptype=8' + variables, onready);
    > //initMapGSmap();
    > createGSlayer('GSmaptype=1' + variables);
    > //reset
    > j = 0;
    > i = new Array();
    >
    > return true;
    > }
    >
    > // run a search (prior to updating the map)
    > function getsearchdata() {
    > var variables = getformparameters(document.getElementById('sea'), '');
    > variables = variables + "&map=1";
    > var el = document.getElementById('c2');
    > el.checked = true;
    > var el = document.getElementById('syes');
    > el.checked = true;
    > var onready = "updatesearchresults";
    > var url = "searcher.php";
    > UpdateHtml(url, variables, onready);
    > return true;
    > }
    >
    > //------------------------------------ FORM interaction
    >
    > //gets all variables from a form
    > function getformparameters(obj, getstr) {
    > j++;
    > for (i[j]=0; i[j] < obj.childNodes.length; i[j]++) {
    > var newobj = obj.childNodes[i[j]];
    > tgname = newobj.tagName
    > if(tgname) {
    > tgname.toLowerCase;
    > if (tgname == "INPUT") {
    > var tvalue = newobj.value;
    > if(tvalue != 0 && tvalue != "") {
    > var ttype = newobj.type;
    > var tname = newobj.name;
    > if (ttype == "text") {
    > getstr += "&" + tname + "=" + tvalue ;
    > }
    > if (ttype == "checkbox") {
    > if (newobj.checked) {
    > getstr += "&" + tname + "=" + tvalue;
    > }
    > else {
    > getstr += "&" + tname + "=0";
    > }
    > }
    > if (ttype == "radio") {
    > if (newobj.checked) {
    > getstr += "&" + tname + "=" + tvalue;
    > }
    > }
    > }
    > }
    > if (tgname == "SELECT") {
    > var sel = newobj;
    > var tvalue = sel.options[sel.selectedIndex].value;
    > if(tvalue != 0 && tvalue != "") {
    > getstr += "&" + sel.name + "=" + tvalue;
    > }
    > }
    > }
    > if(newobj.childNodes.length > 0 && j < jmax) {
    > getstr = getformparameters(newobj, getstr);
    > }
    > }
    >
    > j--;
    > return getstr;
    > }
    >
    > //------------------------------------ AJAX STARTER
    > //open xml sheet on the server and specify the function to run when the
    > xml is loaded
    > function UpdateHtml(url, parameters, onready) {
    > http_request = false;
    > if (window.XMLHttpRequest) { // Mozilla, Safari,...
    > http_request = new XMLHttpRequest();
    > if (http_request.overrideMimeType) {
    > // set type accordingly to anticipated content type
    > http_request.overrideMimeType('text/xml');
    > //http_request.overrideMimeType('text/html');
    > }
    > }
    > else if (window.ActiveXObject) { // IE
    > try {
    > http_request = new ActiveXObject("Msxml2.XMLHTTP");
    > }
    > catch (e) {
    > try {
    > http_request = new ActiveXObject("Microsoft.XMLHTTP");
    > }
    > catch (e) {
    > alert('could not load data');
    > }
    > }
    > }
    > if (!http_request) {
    > alert('Cannot create XMLHTTP instance');
    > return false;
    > }
    > if(onready == "updatemap") {
    > http_request.onreadystatechange = updatemap;
    > }
    > else {
    > http_request.onreadystatechange = updatesearchresults;
    > }
    > var geturl = url + '?' + parameters;
    > document.getElementById(idname + 'title').innerHTML = "loading new map
    > ... "; //+ geturl;
    > http_request.open('GET', geturl, true);
    > http_request.async = false;
    > http_request.send(null);
    > }
    >
    > // -------------- process XML ----------------------------
    > //process map data
    > function updatemap() {
    > if (http_request.readyState == 4) {
    > if (http_request.status == 200) {
    > //alert(http_request.responseText);
    > var xmlDoc = http_request.responseXML;
    > var titlearray = xmlDoc.getElementsByTagName('title');
    > var infoarray = xmlDoc.getElementsByTagName('info');
    > var zoomarray = xmlDoc.getElementsByTagName('zoom');
    > var longitudearray = xmlDoc.getElementsByTagName('longitude');
    > var lattitudearray = xmlDoc.getElementsByTagName('lattitude');
    > var info = serializeNode(infoarray[0]);
    > var a = lattitudearray[0].firstChild.nodeValue;
    > var o = longitudearray[0].firstChild.nodeValue;
    > var z = zoomarray[0].firstChild.nodeValue;
    > if(document.getElementById(idname + 'title')) {
    > document.getElementById(idname + 'title').innerHTML =
    > titlearray[0].firstChild.nodeValue;
    > }
    > if (document.getElementById(idname + 'info') && 1 == 2) {
    > document.getElementById(idname + 'info').innerHTML = info;
    > }
    > if(document.getElementById('outerinfo')) {
    > document.getElementById('outerinfo').innerHTML = '' + info + '';
    > }
    > GSrezoom(o,a,z);
    > }
    > else {
    > alert('There was a problem with the request.');
    > }
    > }
    > else {
    >
    > }
    > }
    >
    > //process search results
    > function updatesearchresults() {
    > if (http_request.readyState == 4) {
    > if (http_request.status == 200) {
    > var xmlDoc = http_request.responseXML;
    > var humansqlarray = xmlDoc.getElementsByTagName('humansql');
    > var humansql = serializeNode(humansqlarray[0]);
    > document.getElementById('humansql').innerHTML = humansql;
    > changemap();
    > }
    > else {
    > alert('There was a problem with the request.');
    > }
    > }
    > }
    >
    > // -------------- XML details ----------------------------
    > //retrieve data from XML sheet
    > function serializeNode(node) {
    > if(node != undefined) {
    > var xml = "";
    > if(_browser.isSafari) {
    > xml = xmlText(node);
    > }
    > else if(_browser.isIE) {
    > xml = node.xml;
    > }
    > else {
    > var serializer = new XMLSerializer();
    > xml = serializer.serializeToString(node);
    > }
    > return xml;
    > }
    > else {
    > return undefined;
    > }
    > }
    >
    > var DOM_ELEMENT_NODE = 1;
    > var DOM_TEXT_NODE = 3;
    >
    >
    > /**
    > * Returns the representation of a node as XML text.
    > */
    > function xmlText(node) {
    > var ret = '';
    > if (node.nodeType == DOM_TEXT_NODE) {
    > ret += node.nodeValue;
    > }
    > else if (node.nodeType == DOM_ELEMENT_NODE) {
    > ret += '<' + node.nodeName;
    > for (var i = 0; i < node.attributes.length; ++i) {
    > var a = node.attributes;
    > if (a && a.nodeName && a.nodeValue) {
    > ret += ' ' + a.nodeName;
    > ret += '="' + a.nodeValue + '"';
    > }
    > }
    > if (node.childNodes.length == 0) {
    > ret += '/>';
    > }
    > else {
    > ret += '>';
    > for (var i = 0; i < node.childNodes.length; ++i) {
    > ret += arguments.callee(node.childNodes);
    > }
    > ret += '</' + node.nodeName + '>';
    > }
    > }
    > return ret;
    > }



    May I ask _why_ You don't have access to IE 6 anymore?

    If it's because you have upgraded to IE7, please check out
    http://labs.insert-title.com/labs/Multiple-IEs-in-Windows_article795.aspx
    which will guide you in installing multiple versions of IE on Windows
    XP.

    If it's because you are using Linux, you can install wine, and then
    download ies4linux, found at
    http://www.tatanka.com.br/ies4linux/page/Main_Page, which will give you
    versions 5, 5.5 and 6 all running about as bug free as IE ever ran
    before.

    All the best.

    Daz.
     
    Daz, Dec 10, 2006
    #2
    1. Advertising

  3. windandwaves

    windandwaves Guest

    windandwaves, Dec 11, 2006
    #3
  4. windandwaves

    windandwaves Guest

    windandwaves wrote:

    I just found the problem... IE6 does not like the following line:

    http_request.async = false;

    So I took it out. The result, however, is that the script does not
    seem to wait for one thing to finish before doing the next thing or
    something like that. Well, it still works in FF, but not in IE6.
    However, there are no errors in IE6.

    Can someone tell me what
    http_request.async = false;
    means.... I think it means "do not process this out of sync with the
    rest of the script"

    and can someone tell me how to replace it with something more pallatble
    for IE6?

    Thank you

    Nicolaas
     
    windandwaves, Dec 11, 2006
    #4
  5. windandwaves

    Daz Guest

    windandwaves wrote:

    > windandwaves wrote:
    >
    > I just found the problem... IE6 does not like the following line:
    >
    > http_request.async = false;
    >
    > So I took it out. The result, however, is that the script does not
    > seem to wait for one thing to finish before doing the next thing or
    > something like that. Well, it still works in FF, but not in IE6.
    > However, there are no errors in IE6.
    >
    > Can someone tell me what
    > http_request.async = false;
    > means.... I think it means "do not process this out of sync with the
    > rest of the script"
    >
    > and can someone tell me how to replace it with something more pallatble
    > for IE6?
    >
    > Thank you
    >
    > Nicolaas


    Hi. Basically it tells the script to wait until it has received all of
    the incoming data from the server, or in other words, to run
    asynchronously with the server until the server stops sending data (or
    in this case, tells the browser it's finished sending data). Otherwise
    you are effectively processing data that might not be there, and in
    fact, probably isn't.

    I believe that for IE, you need to create a new ActiveXObject. As
    Microsoft choose to be different, you will need to look into AJAX. This
    article should get you on your way.
    http://www.wwwcoder.com/main/parentid/81/site/6044/68/default.aspx

    Best of luck.

    Daz.
     
    Daz, Dec 11, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Benson
    Replies:
    10
    Views:
    477
    Dennis Lee Bieber
    Jan 21, 2004
  2. POLO TSHIRT
    Replies:
    0
    Views:
    210
    POLO TSHIRT
    Nov 8, 2010
  3. J. Hall
    Replies:
    8
    Views:
    132
    kaeli
    Jul 14, 2004
  4. Bob
    Replies:
    8
    Views:
    102
    Erik Max Francis
    Sep 22, 2003
  5. Îίκος Αλεξόπουλος

    Cookie aint retrieving when visiting happens from a backlink.

    Îίκος Αλεξόπουλος, Oct 25, 2013, in forum: Python
    Replies:
    26
    Views:
    238
    Nick the Gr33k
    Oct 27, 2013
Loading...

Share This Page