Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > help! I dont have IE6 and apparently it aint working

Reply
Thread Tools

help! I dont have IE6 and apparently it aint working

 
 
windandwaves
Guest
Posts: n/a
 
      12-10-2006
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[i];
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[i]);
}
ret += '</' + node.nodeName + '>';
}
}
return ret;
}

 
Reply With Quote
 
 
 
 
Daz
Guest
Posts: n/a
 
      12-10-2006

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[i];
> 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[i]);
> }
> 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/Mu...rticle795.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.

 
Reply With Quote
 
 
 
 
windandwaves
Guest
Posts: n/a
 
      12-11-2006

Daz wrote:
......
> May I ask _why_ You don't have access to IE 6 anymore?
>


Installed 7, followed the link and found...

http://browsers.evolt.org/download.p...e6eolas_nt.zip

will install and work with that one.

 
Reply With Quote
 
windandwaves
Guest
Posts: n/a
 
      12-11-2006

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

 
Reply With Quote
 
Daz
Guest
Posts: n/a
 
      12-11-2006

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/parenti...8/default.aspx

Best of luck.

Daz.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
u want to have a more happy christmas day.dont lost the choice and goto have a see our products, POLO TSHIRT Python 0 11-08-2010 12:31 AM
Add attribute - apparently I have to Haydnw ASP .Net 5 08-09-2004 01:00 AM
I have created a website "lookup" i dont think its gonna get bigger and fancyer than it already is but have a look Rahmi Acar C++ 0 04-20-2004 10:18 PM
best book: aint no such thing, and encouragement for old coots John Benson Python 10 01-21-2004 06:17 AM
SpellCheck aint working Matthew Morrison Computer Support 4 07-07-2003 12:35 AM



Advertisments