473,473 Members | 1,562 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

null or not an object error in IE works perfectly in Firefox

3 New Member
Expand|Select|Wrap|Line Numbers
  1. // JavaScript Document
  2. var easy = "046280000500600740200000000005032070021000480030170500000000005094001007000096830";
  3. var easySplit = easy.split('');
  4. var eAns = "946287351583619742217543698865432179721965483439178526678324915394851267152796834";
  5. var eAnspl = eAns.split('');
  6. var medium = "000800017430000000002000900200008000097603480000700005006000100000000048580001000";
  7. var medSplit = medium.split('');
  8. var medAns = '659824317431597826872136954265948731197653482348712695926485173713269548584371269';
  9. var mAnspl = medAns.split('');
  10. var hard = "900001050765000000100300008000006040000218000090400000600004002000000837030100005";
  11. var hardSplit = hard.split('');
  12. var hardAns = '983721654765849321124365798817956243346218579592473186678534912451692837239187465';
  13. var hAnspl = hardAns.split('');
  14.  
  15. var sudokuTable = {
  16.  
  17.     nonjsTable:function()
  18.     {
  19.         document.forms['sudo'].reset();
  20.         var table = document.getElementById('sudoForm');
  21.         var inp = table.getElementsByTagName('input');
  22.         for(var i=0; i<81; i++){
  23.  
  24.             inp[i].setAttribute('id', (i+1));
  25.             inp[i].setAttribute('readonly', 'true');
  26.             inp[i].setAttribute('onchange', 'levels.change(this.id)');
  27.         }
  28.     }
  29.  
  30. }
  31.  
  32.  
  33. // deals with function to load numbers for each level
  34.  
  35. var levels = {
  36.         eCheck : easy.split(''),
  37.         mCheck : medium.split(''),
  38.         hCheck : hard.split(''),
  39.         box : null,
  40.         current : null,
  41.         lev : null,
  42.         levnans : null,
  43.         //cell : document.getElementById('sudoForm'),
  44.  
  45.     cLevels:function(levSplit, answer)
  46.     {
  47.         levels.levans = answer;
  48.         levels.lev = levSplit;
  49.         levels.eCheck = easy.split('');
  50.         document.forms['sudo'].reset();
  51.  
  52.         for(var i=0; i<81; i++)
  53.         {
  54.             if(levSplit[i]==0)
  55.             {
  56.                 document.forms['sudo'].elements[i].setAttribute('value', '');
  57.                 document.forms['sudo'].elements[i].removeAttribute('readonly');
  58.             }
  59.             else
  60.             {
  61.                 document.forms['sudo'].elements[i].setAttribute('value', levSplit[i]); 
  62.                 document.forms['sudo'].elements[i].setAttribute('readonly', 'true' );
  63.             }
  64.  
  65.         }
  66.  
  67.     },
  68.  
  69.     change:function(d)
  70.     {
  71.         levels.box = document.getElementById(d);
  72.         levels.current = levels.levans[d-1];
  73.         if(levels.box.value==0)
  74.         {
  75.             levels.box.value = '';
  76.         }
  77.     },
  78.  
  79.     check:function()
  80.     {
  81.         if(levels.box.value==levels.current)
  82.         {
  83.             alert('The value is correct');
  84.         }
  85.         else
  86.         {
  87.             alert('incorrect value..please try again');
  88.         }
  89.     }
  90.  
  91.  
  92.  
  93. }
I would say i am a novice at javascript and i had this project to do for university for a sudoku game. The code works fine in firefox but tells me that levels.box is null or not an object for some reason. It would be great if someone could help me out as i am not sure why IE does this. Thanks in advance for your help.

Moj
May 18 '07 #1
21 38489
modeep
3 New Member
found a solution. basically Internet Explorer is crappy and doesnt like the setAttribute property so had to change the onchange handler by directly changing the attrbute for the object like so.
object.onchange = function() {}

Incase anyone has a problem like this i hope the solution helps

Moj
May 19 '07 #2
grimlockhale
1 New Member
Hi,

Would you be able to paste in your new code. I'm having the exact same problem, I just don't know how to apply what you wrote: object.onchange=function(){}.

Thanks
grim



found a solution. basically Internet Explorer is crappy and doesnt like the setAttribute property so had to change the onchange handler by directly changing the attrbute for the object like so.
object.onchange = function() {}

Incase anyone has a problem like this i hope the solution helps

Moj
Jun 22 '07 #3
acoder
16,027 Recognized Expert Moderator MVP
Hi,

Would you be able to paste in your new code. I'm having the exact same problem, I just don't know how to apply what you wrote: object.onchange=function(){}.

Thanks
grim
Welcome to TSDN!

I am assuming he meant line 26 which would be changed to:
Expand|Select|Wrap|Line Numbers
  1. inp[i].onchange = function() {...
If you can't solve it post your code (using code tags please).
Jun 23 '07 #4
crazyhorse80
6 New Member
I'm working on a piece of code... I can't get it work with IE, but in FF all is fine...
I think the problem is what you're talking about here, but I can't understand what to do with my code...
Here it is:

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. // Google Maps Mod
  3. // by
  4. // TLM --- Taken Over By brianjw <brianjw@verizon.net>
  5.  
  6. // We calling this directly, if so, your evil...
  7. if (!defined('SMF'))
  8.     die('Hacking attempt...');
  9.  
  10. function Map() {
  11.     global $db_prefix, $context;
  12.  
  13.     // Are we allowed to view the map? Keep in mind here we should be a guest unless user is in IE!
  14.     isAllowedTo('googleMap_view');
  15.  
  16.  
  17.     //Lets try this to make it work on first click...
  18.     //loadUserSettings();
  19.     writeLog();
  20.  
  21.     //Map using the internal XML File? Or the JS file?
  22.     if (isset($_GET['sa']) && $_GET['sa'] == '.xml')
  23.         return MapsXML();
  24.        if (isset($_GET['sa']) && $_GET['sa'] == '.js')
  25.         return MapsJS();
  26.  
  27.     // Get the template ready.... not really much else to do.
  28.     //loadLanguage('MemberMap');
  29.     loadTemplate('GoogleMap');
  30.     $context['sub_template'] = 'map';
  31.     $context['page_title'] = "Mappa Utenti";
  32. }
  33.  
  34. function MapsJS() {
  35.     global $db_prefix, $context, $scripturl, $txt, $modSettings, $user_info;
  36.  
  37.     // Lets dump everything in the buffer and start clean and new and fresh
  38.     ob_end_clean();
  39.     if (!empty($modSettings['enableCompressedOutput']))
  40.         @ob_start('ob_gzhandler');
  41.     else
  42.         ob_start();
  43.  
  44. echo '
  45.     // arrays to hold copies of the markers and html used by the sidebar
  46.     // because the function closure trick doesnt work there
  47.     var gmarkers = [];
  48.     var htmls = [];
  49.  
  50.     // This function picks up the click and opens the corresponding info window
  51.     function myclick(i) {
  52.       gmarkers[i].openInfoWindowHtml(htmls[i]);
  53.     }
  54.  
  55. function MakeMap() {
  56.     // Globals.
  57.     //Icon(s), and if gender is enabled, php will allow those to be defined.
  58.     var icon = new GIcon();
  59.     icon.image = "http://labs.google.com/ridefinder/images/mm_20_green.png";
  60.     icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
  61.     icon.iconSize = new GSize(12, 20);
  62.     icon.shadowSize = new GSize(22, 20);
  63.     icon.iconAnchor = new GPoint(6, 20);
  64.     icon.infoWindowAnchor = new GPoint(5, 1);
  65.     // For that lovly clustering thing!
  66.     var clusterIcon = new GIcon();
  67.     clusterIcon.image = "http://labs.google.com/ridefinder/images/mm_20_purple.png";
  68.     clusterIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
  69.     clusterIcon.iconSize = new GSize(12, 20);
  70.     clusterIcon.shadowSize = new GSize(22, 20);
  71.     clusterIcon.iconAnchor = new GPoint(6, 20);
  72.     clusterIcon.infoWindowAnchor = new GPoint(5, 1);';
  73. if ($modSettings['googleMapsPinGender'])
  74. echo '
  75.     var iconm = new GIcon();
  76.     iconm.image = "http://labs.google.com/ridefinder/images/mm_20_blue.png";
  77.     iconm.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
  78.     iconm.iconSize = new GSize(12, 20);
  79.     iconm.shadowSize = new GSize(22, 20);
  80.     iconm.iconAnchor = new GPoint(6, 20);
  81.     iconm.infoWindowAnchor = new GPoint(5, 1);
  82.     var iconf = new GIcon();
  83.     iconf.image = "http://labs.google.com/ridefinder/images/mm_20_red.png";
  84.     iconf.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
  85.     iconf.iconSize = new GSize(12, 20);
  86.     iconf.shadowSize = new GSize(22, 20);
  87.     iconf.iconAnchor = new GPoint(6, 20);
  88.     iconf.infoWindowAnchor = new GPoint(5, 1);';
  89.  
  90. echo '
  91.     if (GBrowserIsCompatible()) {
  92.         // this variable will collect the html which will eventually be placed in the sidebar
  93.         var sidebar_html = "";
  94.  
  95.         var i = 0;
  96.  
  97.         // A function to create the marker and set up the event window
  98.         function createMarker(point, icon, name, html) {
  99.             var marker = new GMarker(point, icon);
  100.             GEvent.addListener(marker, "click", function() {
  101.             map.getCenter(point);
  102.             marker.openInfoWindowHtml(html);
  103.             });
  104.             // save the info we need to use later for the sidebar
  105.             gmarkers[i] = marker;
  106.             htmls[i] = html;
  107.             // add a line to the sidebar html';
  108. if ($modSettings['googleSidebar'] == 1)
  109. echo '
  110.             sidebar_html += \'<a href="javascript:myclick(\' + i + \')">\' + name + \'</a><br /> \';';
  111. if ($modSettings['googleSidebar'] == 2)
  112. echo '
  113.             sidebar_html += \'<a href="javascript:myclick(\' + i + \')">\' + name + \'</a>, \';';
  114. echo '
  115.             //Now that we cached it lets return the marker....
  116.             i++;
  117.             return marker;
  118.         }
  119.  
  120.         // create the map
  121.         var map = new GMap2(document.getElementById("map"));
  122.         map.addControl(new GLargeMapControl());
  123.         map.addControl(new GMapTypeControl());
  124.         // Sets the map type based on admin prefrence API 1 !!!
  125.         //map.setMapType(' . $modSettings['googleMapsType'] . ');
  126.         //Kartenübersicht
  127.           map.addControl(new GOverviewMapControl(new GSize(100,75)));
  128.         // Lets load up the default long/lat/zoom for the map for those that like wine.
  129.         map.setCenter(new GLatLng(' . $modSettings['googleMapsDefaultLat'] . ', ' . $modSettings['googleMapsDefaultLong'] . '), ' . $modSettings['googleMapsDefaultZoom'] . ',' . $modSettings['googleMapsType'] . ');
  130.  
  131.         // This is so we can try to cluster some of those pins together so the map does not get over loaded?
  132.         var clusterer = new Clusterer( map );
  133.         clusterer.icon = clusterIcon;
  134.         clusterer.minMarkersPerClusterer = ' . $modSettings['googleMapsMinMarkerCluster'] . ';
  135.         clusterer.maxVisibleMarkers = ' . $modSettings['googleMapsMaxVisMarker'] . ';
  136.         clusterer.GridSize = ' . $modSettings['googleMapsMaxNumClusters'] . ';
  137.         clusterer.MaxLinesPerInfoBox = ' . $modSettings['googleMapsMaxLinesCluster'] . ';
  138.  
  139.         // Read the data
  140.         var request = GXmlHttp.create();
  141.         request.open("GET", "'. $scripturl . '?action=googlemap;sa=.xml", true);
  142.  
  143.         request.onreadystatechange = function() {
  144.             if (request.readyState == 4) {
  145.                 var xmlDoc = request.responseXML;
  146.                 // obtain the array of markers and loop through it
  147.                 var markers = xmlDoc.documentElement.getElementsByTagName("marker");
  148.  
  149.                 for (var i = 0; i < markers.length; i++) {
  150.                     // obtain the attribues of each marker
  151.                     var lat = parseFloat(markers[i].getAttribute("lat"));
  152.                     var lng = parseFloat(markers[i].getAttribute("lng"));
  153.                     var point = new GLatLng(lat,lng);
  154.                     var html = markers[i].getAttribute("html");
  155.                     var label = markers[i].getAttribute("label");
  156.                     // create the marker';
  157. if ($modSettings['googleMapsPinGender'])
  158. echo '
  159.                         if (parseFloat(markers[i].getAttribute("gender")) == 0)
  160.                             var marker = createMarker(point, icon, label, html);
  161.                         if (parseFloat(markers[i].getAttribute("gender")) == 1)
  162.                             var marker = createMarker(point, iconm, label, html);
  163.                         if (parseFloat(markers[i].getAttribute("gender")) == 2)
  164.                             var marker = createMarker(point, iconf, label, html);';
  165. else
  166. echo '
  167.                         var marker = createMarker(point, icon, label, html);';
  168. if ($modSettings['googleMapsEnableClusterer'])
  169.     echo '
  170.                     clusterer.AddMarker(marker, label);';
  171. else
  172.     echo '
  173.                     map.addOverlay(marker);';
  174. echo '
  175.                 }
  176.             // put the assembled sidebar_html contents into the sidebar div
  177.             document.getElementById("sidebar").innerHTML = sidebar_html;
  178.             }
  179.         }
  180.         request.send(null);
  181.     } else {
  182.       alert("Sorry, the Google Maps API is not compatible with this browser");
  183.     }
  184. }
  185.     setTimeout(\'MakeMap()\', 500);
  186. ';
  187.       obExit(false);
  188. }
Can you help me, please?
Bye,
PS
Dec 30 '07 #5
acoder
16,027 Recognized Expert Moderator MVP
A bug in the code tag software means that the code will have to be split up across multiple posts. Here's the second part:
Expand|Select|Wrap|Line Numbers
  1. function MapsXML() {
  2.     global $db_prefix, $context, $scripturl, $txt, $modSettings, $user_info, $themeUser, $memberContext;
  3.  
  4.     // Lets dump everything in the buffer and start clean and new and fresh
  5.     ob_end_clean();
  6.     if (!empty($modSettings['enableCompressedOutput']))
  7.         @ob_start('ob_gzhandler');
  8.     else
  9.         ob_start();
  10.  
  11.     // XML Header
  12.     //header("Content-Type: plain/text; charset=UTF-8");
  13.     header("Content-Type: application/xml; charset=UTF-8");
  14.  
  15.     // Lets find number of members that set there map
  16.     $request = db_query("
  17.     SELECT COUNT(*) as TOTALFOUND
  18.     FROM {$db_prefix}members
  19.     WHERE latitude IS NOT NULL AND longitude IS NOT NULL
  20.     ", __FILE__, __LINE__);
  21.  
  22.     // Pull the answer and store it...
  23.     $totalSet = mysql_fetch_row($request);
  24.  
  25.     // If the total people set there lat/long is greater than googleMapsPinNumber,
  26.     // We check for if we have any bounds that got passed from the JS,
  27.     // If no bounds we just pick the number of googleMapsPinNumber to show...
  28.     // If we are under the max allowed, just show them all!
  29.     if ($totalSet[0] >= $modSettings['googleMapsPinNumber']) {
  30.         // Lets set this to nothing, just to be safe if we dont have variables...
  31.         $sql_addon = "";
  32.  
  33.         // Check to see if we have any ranges before we add to the SQL statment...
  34.         // This could stand to have a bit better security on it but its gonna be let by the side for now
  35.         if ((isset($_GET['minX'])) && (isset($_GET['maxX'])) && (isset($_GET['minY'])) && (isset($_GET['maxY']))) {
  36.             $sql_addon = " AND latitude > " . $_GET['minX'] . "
  37.             AND latitude < " . $_GET['maxX'] . "
  38.             AND longitude > " . $_GET['minY'] . "
  39.             AND longitude < " . $_GET['maxY'];
  40.         }
  41.  
  42.         // Lets just make this simple for the query...
  43.         $maxPins = $modSettings['googleMapsPinNumber'];
  44.  
  45.         // Load the data up at random to the ping count!
  46.         $query = "SELECT *
  47.         FROM {$db_prefix}members
  48.         WHERE latitude IS NOT NULL AND longitude IS NOT NULL
  49.         $sql_addon
  50.         ORDER BY RAND()
  51.         LIMIT 0, $maxPins";
  52.     } else {
  53.         // Looks like we passed under the max, Load everyone...
  54.         $query = "SELECT *
  55.         FROM {$db_prefix}members
  56.         WHERE latitude IS NOT NULL AND longitude IS NOT NULL
  57.         ORDER BY `realName` ASC ";
  58.     }
  59.  
  60.     $request = db_query($query, __FILE__, __LINE__);
  61.  
  62.     //Ok this is block of code takes care of the entire load all member data into $themeUser/$memberContext on per # basis
  63.     $temp = array();
  64.     while ($row = mysql_fetch_array($request, MYSQL_ASSOC))
  65.         $temp[] = $row['ID_MEMBER'];
  66.     loadMemberData($temp);
  67.     foreach ($temp as $v)
  68.         loadMemberContext($v);
  69.  
  70.     // Seeing how SMF 1.0 uses $themeUser and SMF 1.1 uses $memberContext, lets just make our own now?
  71.     if (isset($memberContext))
  72.         $data = $memberContext;
  73.     elseif (isset($themeUser))
  74.         $data = $themeUser;
  75.  
  76.     // Lets accualy start making XML Mr. PHP
  77.     echo '<?xml version="1.0" encoding="UTF-8"?>
  78.     <markers>';
  79.  
  80.     if (isset($data)) {
  81.     // Assuming we have data to work with...
  82.         foreach ($data as $marker) {
  83.                 $datablurb = '
  84.                 <table class="googleMaps" border="0">
  85.                     <tr>
  86.                         <td style="white-space: nowrap;" align="left"><a href="' . $marker['online']['href'] . '"><img src="' . $marker['online']['image_href'] . '" alt="' . $marker['online']['text'] .'" class="avatar" border="0" /></a> <a href="' . $marker['href'] .'">' . $marker['name'] . '</a></td>
  87.                         <td rowspan="3">' . $marker['avatar']['image'] . '</td>
  88.                     </tr><tr>
  89.                         <td style="white-space: nowrap;"><font color="#000000">' . $marker['title'] . '</font></td>
  90.                        </tr><tr>
  91.                         <td style="white-space: nowrap;" align="center">
  92.                             ' . $marker['icq']['link'] . '
  93.                             ' . $marker['aim']['link'] . '
  94.                             ' . $marker['yim']['link'] . '
  95.                             ' . $marker['msn']['link'] . '
  96.                         </td>
  97.                     </tr><tr>
  98.                         <td style="white-space: nowrap;" colspan="2" align="left">';
  99.                 if (($marker['website']['url'] != '') && ($marker['website']['title'] != ''))
  100.                      $datablurb = $datablurb . '<a href="' . $marker['website']['url'] . '">' . $marker['website']['title'] . '</a>';
  101.                 $datablurb = $datablurb . '</td>
  102.                     </tr><tr>
  103.                         <td style="white-space: nowrap;" colspan="2" align="left"><font color="#000000">' . $marker['blurb'] . '</font></td>
  104.                     </tr>
  105.                 </table>';
  106.  
  107.                 // This is to help against those funky chars... and protect against those " errors in XML!
  108.                 $datablurb = htmlspecialchars($datablurb);
  109.  
  110.                 // Lets bring it all together...
  111.                 $markers = '<marker lat="' . $marker['googleMap']['latitude'] . '" lng="' . $marker['googleMap']['longitude'] . '" ';
  112.  
  113.                 if ($marker['gender']['name'] == $txt[238]) {
  114.                     $markers = $markers . 'gender="1"';
  115.                 } elseif ($marker['gender']['name'] == $txt[239]) {
  116.                     $markers = $markers . 'gender="2"';
  117.                 } else {
  118.                     $markers = $markers . 'gender="0"';
  119.                 }
  120.  
  121.                 $markers = $markers . ' label="' . $marker['name'] . '" html="'. $datablurb . '" />';
  122.  
  123.                 echo $markers;
  124.         }
  125.     }
  126.     echo '
  127.     </markers>';
  128.  
  129.     // Ok we should be done with output, dump it to user...
  130.       obExit(false);
  131. }
Dec 30 '07 #6
acoder
16,027 Recognized Expert Moderator MVP
And the final part:
Expand|Select|Wrap|Line Numbers
  1. function ShowKML () {
  2.       global $db_prefix, $context, $scripturl, $txt, $modSettings, $user_info, $mbname, $themeUser, $memberContext;
  3.  
  4.     // Are we allowed to view the map? Keep in mind here we should be a guest unless user is in IE!
  5.     isAllowedTo('googleMap_view');
  6.  
  7.     // If it's not enabled, die.
  8.     if (empty($modSettings['xmlnews_enable']))
  9.         obExit(false);
  10.  
  11.     // This is an kml file, its like an XML file...
  12.     ob_end_clean();
  13.     if (!empty($modSettings['enableCompressedOutput']))
  14.         @ob_start('ob_gzhandler');
  15.     else
  16.         ob_start();
  17.  
  18.     // Lets make sure its sent as KML
  19.     header('Content-type: application/keyhole;');
  20.  
  21.     // It will be called ourforumname.kml
  22.     header('Content-Disposition: attachment; filename="' . $mbname . '.kml"');
  23.  
  24.     // Load the data up, and seeing how its google earth, lets just send everything.
  25.     // If we get complaints about this, then we shall have to figure out how to limit it.
  26.     $request = db_query("
  27.     SELECT *
  28.     FROM {$db_prefix}members
  29.     WHERE latitude IS NOT NULL AND longitude IS NOT NULL
  30.     ", __FILE__, __LINE__);
  31.  
  32.     //Ok this is block of code takes care of the entire load all member data into $memberContext on per # basis
  33.     $temp = array();
  34.     while ($row = mysql_fetch_array($request, MYSQL_ASSOC))
  35.         $temp[] = $row['ID_MEMBER'];
  36.     loadMemberData($temp);
  37.     foreach ($temp as $v)
  38.         loadMemberContext($v);
  39.  
  40.        // Seeing how SMF 1.0 uses $themeUser and SMF 1.1 uses $memberContext, lets just make our own now?
  41.     if (isset($memberContext))
  42.         $data = $memberContext;
  43.     elseif (isset($themeUser))
  44.         $data = $themeUser;
  45.  
  46. echo '<?xml version="1.0" encoding="UTF-8"?>
  47.     <kml xmlns="http://earth.google.com/kml/2.0">
  48.     <Folder>
  49.         <name>' . $mbname . '</name>
  50.         <open>0</open>';
  51.     if (isset($data)) {
  52.     // Assuming we have data to work with...
  53.         foreach ($data as $marker) {
  54. echo '
  55.         <Placemark>
  56.             <description>
  57.                 <![CDATA[';
  58. echo '
  59.                 <table class="googleMaps" border="0" style="white-space: nowrap;">
  60.                     <tr>
  61.                         <td style="white-space: nowrap;" align="left"><a href="' . $marker['online']['href'] . '"><img src="' . $marker['online']['image_href'] . '" alt="' . $marker['online']['text'] .'" class="avatar" border="0" /></a> <a href="' . $marker['href'] .'">' . $marker['name'] . '</a></td>
  62.                         <td rowspan="3">' . $marker['avatar']['image'] . '</td>
  63.                     </tr><tr>
  64.                         <td style="white-space: nowrap;">' . $marker['title'] . '</td>
  65.                        </tr><tr>
  66.                         <td style="white-space: nowrap;" align="center">
  67.                             ' . $marker['icq']['link'] . '
  68.                             ' . $marker['aim']['link'] . '
  69.                             ' . $marker['yim']['link'] . '
  70.                             ' . $marker['msn']['link'] . '
  71.                         </td>
  72.                     </tr><tr>
  73.                         <td style="white-space: nowrap;" colspan="2" align="left">';
  74.                 if (($marker['website']['url'] != '') && ($marker['website']['title'] != ''))
  75.                     echo '<a href="' . $marker['website']['url'] . '">' . $marker['website']['title'] . '</a>';
  76. echo '                    </td>
  77.                     </tr><tr>
  78.                         <td style="white-space: nowrap;" colspan="2" align="left">' . $marker['blurb'] . '</td>
  79.                     </tr>
  80.                 </table>';
  81. echo '
  82.                 ]]>
  83.             </description>
  84.             <name>' . $marker['name'] . '</name>
  85.             <LookAt>
  86.                 <longitude>' . $marker['googleMap']['longitude'] . '</longitude>
  87.                 <latitude>' . $marker['googleMap']['latitude'] . '</latitude>
  88.                 <range>15000</range>
  89.             </LookAt>
  90.             <styleUrl>root://styles#default+icon=0x304</styleUrl>';
  91. /* This does not appeal to me right now...
  92.             if ($modSettings['googleMapsPinGender']) {
  93. echo '
  94.             <Style>
  95.                 <IconStyle>
  96.                     <color>';
  97.                     if ($marker['gender']['name'] == "Male") {
  98.                         echo 'ffff6464';
  99.                     } elseif ($marker['gender']['name'] == "Female") {
  100.                         echo 'ff6464ff';
  101.                     } else {
  102.                         echo 'ff64ff64';
  103.                     }
  104. echo '                </color>
  105.                 </IconStyle>
  106.             </Style>';
  107.             }
  108. */
  109.  
  110. echo '
  111.             <Point>
  112.                 <extrude>1</extrude>
  113.                 <altitudeMode>absolute</altitudeMode>
  114.                 <coordinates>' . $marker['googleMap']['longitude'] . ',' . $marker['googleMap']['latitude'] . ',8000</coordinates>
  115.             </Point>
  116.         </Placemark>';
  117.         }
  118.     }
  119.  
  120. echo '
  121.     </Folder>
  122. </kml>';
  123.     // Ok done, should send everything now..
  124.     obExit(false);
  125. }
  126. ?>
Dec 30 '07 #7
acoder
16,027 Recognized Expert Moderator MVP
Welcome to TSDN!
I'm working on a piece of code... I can't get it work with IE, but in FF all is fine...
I think the problem is what you're talking about here, but I can't understand what to do with my code...
Phew! A lot of code to decipher! So, is that the error that you're getting (null or not an object)? Which line does it occur on?
Dec 30 '07 #8
crazyhorse80
6 New Member
The error occours on line 147 of the first chunk of code... But I'm realizing it could be related to the header of the XML file created by function on line 1 of the second chunk... I've inserted a test point and IE goes in Quirk Mode, so I think it's not recognizing any XML to process in that file... FF goes straight like a train!
Can you help me with this?
Bye and thanks for your greetings,
PS

EDIT: I think I must add this:

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  2.   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4.  
To the XML page created by function but I dunno how to do it...
Dec 30 '07 #9
acoder
16,027 Recognized Expert Moderator MVP
Check if responseXML is correct by alerting it. Is it as you expect it to be?

It's an XML document, so the XML prolog that you already have should be fine.
Dec 31 '07 #10
crazyhorse80
6 New Member
I can't understand what I have to do... Can you post the code? I'm not a PHP programmer, I just took that code and trying to make it work...
Tnx,
PS

EDIT: I found this link
http://dean.edwards.name/weblog/2006/04/easy-xml/
It has an interesting chunk of code (the last one); could you help me arranging it to be suitable for my function?
Dec 31 '07 #11
acoder
16,027 Recognized Expert Moderator MVP
Between lines 145 and 147, add an alert: alert(xmlDoc). Is it the expected XML?
Dec 31 '07 #12
crazyhorse80
6 New Member
This is what it does with FireFox:


???

And this is with IE:



But the best thing is that now, when I click OK in the alert box with IE, the code works as it is expected to do! What could be then? Timings problems? How could then I solve?
Tnx,
PS
Dec 31 '07 #13
acoder
16,027 Recognized Expert Moderator MVP
But the best thing is that now, when I click OK in the alert box with IE, the code works as it is expected to do! What could be then? Timings problems? How could then I solve?
That's strange. The ready state is already 4, so the alert shouldn't make a difference. If you check the documentElement, is that also an object?

One other thing, for responseXML to work, the mime-type should be "text/xml". You have set it to "application/xml". I don't know if that makes a difference.
Dec 31 '07 #14
crazyhorse80
6 New Member
That's strange. The ready state is already 4, so the alert shouldn't make a difference. If you check the documentElement, is that also an object?
Yes it is.

One other thing, for responseXML to work, the mime-type should be "text/xml". You have set it to "application/xml". I don't know if that makes a difference.
I did already change it...

But now it comes the unbelievable thing:
I've just removed the alert(XmlDoc); and all is working fine even with IE... I'm going mad! I was trying to get it working for a week, and now it works by its own??? Too bad... Ah, I've empty browser cache, cookies and all temp files every time I tried something new...
So I can say problem solved... Thank you very very much!
Bye,
PS
Dec 31 '07 #15
acoder
16,027 Recognized Expert Moderator MVP
It must've been something else that you changed.

Anyway, glad to hear that you got it working. Post again if you have any more JavaScripting problems and someone should be at hand to solve them.
Dec 31 '07 #16
drhowarddrfine
7,435 Recognized Expert Expert
I don't know if it's related but a post above made me wonder if the OP is aware that IE does not recgonize XHTML.
Dec 31 '07 #17
crazyhorse80
6 New Member
I can't understand... What does OP stands for?
Dec 31 '07 #18
drhowarddrfine
7,435 Recognized Expert Expert
"Original Poster" .
Dec 31 '07 #19
acoder
16,027 Recognized Expert Moderator MVP
I don't know if it's related but a post above made me wonder if the OP is aware that IE does not recgonize XHTML.
I don't think the original problem had anything to do with XHTML. That was answered by the OP himself. IE does not set event handlers (onchange, onclick, etc.) with setAttribute unlike other browsers (tell me something new!). Are you talking about post #9 here?
Dec 31 '07 #20
drhowarddrfine
7,435 Recognized Expert Expert
Are you talking about post #9 here?
Yes, that's what caught my eye.
Jan 1 '08 #21
acoder
16,027 Recognized Expert Moderator MVP
Yes, that's what caught my eye.
It was unnecessary anyway - it wasn't XHTML, just XML.
Jan 1 '08 #22

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Jim Marquardson | last post by:
Hi, I've struggled with this for a while now, so I'm asking for help. I am trying to click on a link in one page, have that link open up in a new window, and set that newly opened window's...
4
by: faylau | last post by:
Hi, I copied some javascript code off of this group to keep a banner in view as the user scrolls down the page. The code works fine in Firefox and Netscape but not in IE. Just wondering if...
12
by: CalgaryWebGuy | last post by:
Please help, My class assignment is due today and I am all finished except for one small portion. The instructor wants us to import a script from somewhere else, and for some reason I...
4
by: Hansen | last post by:
Hi! I have a try/catch statement on my webpage, in which a create som html. Sometimes this routine fails and the catch writes the error in an alert box. My problem is that the only thing the...
3
by: aryayudhi | last post by:
I have a html page that has javascript that works perfectly in IE, but not in Firefox. The use of this javascript to change "Tab" to "Enter" Button. When we press Tab, it is like when we press Enter...
0
by: stillworkingfortheman | last post by:
I'm loosing cookies in IE6 (works okay with firefox) with the following steps... step 1. set a cookie in one domain, in an .aspx.cs codebehind... in www.domain.com/subdomain1/page1.aspx...
2
alexphd
by: alexphd | last post by:
This code works in firefox perfectly, but in Internet Explorer it does not calculate the total correctly. Anybody know why? <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"...
3
by: jnhemley | last post by:
I have a script that works in Firefox but not IE6- <script language="JavaScript" type="text/javascript"> document.Params.ThisPageURL.value=document.URL; var x = new Date ();...
7
by: mike57 | last post by:
The minimal AJAX script below works in Firefox, but not in IE, Opera, or Chrome. I could use some suggestions or referrals to resources that will help me get the script working in other browsers. ...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.