2009-09-15 46 views
0

此JavaScript在FF v3.5.3中正常工作,但不在IE 6.02中。能夠在IE JS兼容性方面有經驗的人可以查看可能的不兼容問題的代碼嗎?我沒有包含所有被調用的函數的代碼,因爲這會使我的代碼樣本很大,但我已經在IE中測試了這些函數,並且它們工作正常。我認爲問題在於我如何遍歷JSON數據。謝謝!這裏似乎有一些IE不兼容的javascript。有沒有瀏覽器兼容性專家?

<script type="text/javascript"> 
jsInit("http://railsacrosseurope.com/public", 
     "http://railsacrosseurope.com", 
     "http://apps.facebook.com/rails_across_europe", 
     "85572859349"); 
var routeData = [{"id":1,"c1_id":43,"c2_id":56,"cost":20,"c1_x":658,"c1_y":68,"c2_x":568,"c2_y":149,"owned":false},{"id":2,"c1_id":27,"c2_id":56,"cost":25,"c1_x":571,"c1_y":10,"c2_x":568,"c2_y":149,"owned":false},{"id":3,"c1_id":39,"c2_id":56,"cost":20,"c1_x":510,"c1_y":53,"c2_x":568,"c2_y":149,"owned":false},{"id":4,"c1_id":56,"c2_id":8,"cost":18,"c1_x":568,"c1_y":149,"c2_x":495,"c2_y":202,"owned":false},{"id":5,"c1_id":56,"c2_id":49,"cost":14,"c1_x":568,"c1_y":149,"c2_x":605,"c2_y":217,"owned":false},{"id":6,"c1_id":49,"c2_id":4,"cost":14,"c1_x":605,"c1_y":217,"c2_x":572,"c2_y":282,"owned":false},{"id":7,"c1_id":8,"c2_id":10,"cost":11,"c1_x":495,"c1_y":202,"c2_x":448,"c2_y":250,"owned":false},{"id":8,"c1_id":4,"c2_id":48,"cost":10,"c1_x":572,"c1_y":282,"c2_x":504,"c2_y":293,"owned":false},{"id":9,"c1_id":48,"c2_id":10,"cost":12,"c1_x":504,"c1_y":293,"c2_x":448,"c2_y":250,"owned":false},{"id":10,"c1_id":10,"c2_id":31,"cost":17,"c1_x":448,"c1_y":250,"c2_x":450,"c2_y":370,"owned":false},{"id":11,"c1_id":48,"c2_id":33,"cost":16,"c1_x":504,"c1_y":293,"c2_x":530,"c2_y":373,"owned":false},{"id":12,"c1_id":10,"c2_id":35,"cost":14,"c1_x":448,"c1_y":250,"c2_x":372,"c2_y":250,"owned":false},{"id":13,"c1_id":33,"c2_id":47,"cost":17,"c1_x":530,"c1_y":373,"c2_x":479,"c2_y":431,"owned":false},{"id":14,"c1_id":33,"c2_id":31,"cost":15,"c1_x":530,"c1_y":373,"c2_x":450,"c2_y":370,"owned":false},{"id":15,"c1_id":47,"c2_id":57,"cost":9,"c1_x":479,"c1_y":431,"c2_x":479,"c2_y":466,"owned":false},{"id":16,"c1_id":57,"c2_id":60,"cost":12,"c1_x":479,"c1_y":466,"c2_x":484,"c2_y":527,"owned":false},{"id":17,"c1_id":60,"c2_id":17,"cost":12,"c1_x":484,"c1_y":527,"c2_x":521,"c2_y":511,"owned":false},{"id":18,"c1_id":17,"c2_id":58,"cost":13,"c1_x":521,"c1_y":511,"c2_x":598,"c2_y":527,"owned":false},{"id":19,"c1_id":58,"c2_id":36,"cost":10,"c1_x":598,"c1_y":527,"c2_x":650,"c2_y":584,"owned":false},{"id":20,"c1_id":57,"c2_id":7,"cost":16,"c1_x":479,"c1_y":466,"c2_x":430,"c2_y":432,"owned":false},{"id":21,"c1_id":57,"c2_id":54,"cost":14,"c1_x":479,"c1_y":466,"c2_x":430,"c2_y":462,"owned":false},{"id":22,"c1_id":31,"c2_id":59,"cost":16,"c1_x":450,"c1_y":370,"c2_x":350,"c2_y":344,"owned":false},{"id":23,"c1_id":35,"c2_id":59,"cost":14,"c1_x":372,"c1_y":250,"c2_x":350,"c2_y":344,"owned":false},{"id":24,"c1_id":59,"c2_id":29,"cost":19,"c1_x":350,"c1_y":344,"c2_x":260,"c2_y":314,"owned":false},{"id":25,"c1_id":59,"c2_id":12,"cost":12,"c1_x":350,"c1_y":344,"c2_x":299,"c2_y":395,"owned":false},{"id":26,"c1_id":12,"c2_id":2,"cost":6,"c1_x":299,"c1_y":395,"c2_x":290,"c2_y":400,"owned":false},{"id":27,"c1_id":2,"c2_id":22,"cost":10,"c1_x":290,"c1_y":400,"c2_x":255,"c2_y":412,"owned":false},{"id":28,"c1_id":22,"c2_id":29,"cost":16,"c1_x":255,"c1_y":412,"c2_x":260,"c2_y":314,"owned":false},{"id":29,"c1_id":29,"c2_id":14,"cost":14,"c1_x":260,"c1_y":314,"c2_x":232,"c2_y":257,"owned":false},{"id":30,"c1_id":29,"c2_id":9,"cost":10,"c1_x":260,"c1_y":314,"c2_x":209,"c2_y":300,"owned":false},{"id":31,"c1_id":9,"c2_id":32,"cost":8,"c1_x":209,"c1_y":300,"c2_x":192,"c2_y":308,"owned":false},{"id":32,"c1_id":32,"c2_id":16,"cost":12,"c1_x":192,"c1_y":308,"c2_x":170,"c2_y":225,"owned":false},{"id":33,"c1_id":16,"c2_id":15,"cost":10,"c1_x":170,"c1_y":225,"c2_x":195,"c2_y":166,"owned":false},{"id":34,"c1_id":32,"c2_id":37,"cost":11,"c1_x":192,"c1_y":308,"c2_x":155,"c2_y":315,"owned":true},{"id":35,"c1_id":37,"c2_id":19,"cost":9,"c1_x":155,"c1_y":315,"c2_x":101,"c2_y":285,"owned":true},{"id":36,"c1_id":19,"c2_id":1,"cost":12,"c1_x":101,"c1_y":285,"c2_x":70,"c2_y":330,"owned":true},{"id":37,"c1_id":19,"c2_id":5,"cost":12,"c1_x":101,"c1_y":285,"c2_x":131,"c2_y":243,"owned":false},{"id":38,"c1_id":22,"c2_id":41,"cost":12,"c1_x":255,"c1_y":412,"c2_x":304,"c2_y":461,"owned":true},{"id":39,"c1_id":41,"c2_id":18,"cost":12,"c1_x":304,"c1_y":461,"c2_x":350,"c2_y":499,"owned":true},{"id":40,"c1_id":18,"c2_id":45,"cost":8,"c1_x":350,"c1_y":499,"c2_x":370,"c2_y":504,"owned":false},{"id":41,"c1_id":45,"c2_id":54,"cost":13,"c1_x":370,"c1_y":504,"c2_x":430,"c2_y":462,"owned":false},{"id":42,"c1_id":54,"c2_id":34,"cost":14,"c1_x":430,"c1_y":462,"c2_x":400,"c2_y":532,"owned":false},{"id":43,"c1_id":34,"c2_id":51,"cost":19,"c1_x":400,"c1_y":532,"c2_x":408,"c2_y":623,"owned":false},{"id":44,"c1_id":41,"c2_id":26,"cost":16,"c1_x":304,"c1_y":461,"c2_x":300,"c2_y":554,"owned":true},{"id":45,"c1_id":26,"c2_id":55,"cost":11,"c1_x":300,"c1_y":554,"c2_x":270,"c2_y":573,"owned":false},{"id":46,"c1_id":26,"c2_id":40,"cost":12,"c1_x":300,"c1_y":554,"c2_x":350,"c2_y":585,"owned":false},{"id":47,"c1_id":40,"c2_id":51,"cost":13,"c1_x":350,"c1_y":585,"c2_x":408,"c2_y":623,"owned":false},{"id":48,"c1_id":60,"c2_id":53,"cost":17,"c1_x":484,"c1_y":527,"c2_x":470,"c2_y":610,"owned":false},{"id":49,"c1_id":53,"c2_id":51,"cost":11,"c1_x":470,"c1_y":610,"c2_x":408,"c2_y":623,"owned":false},{"id":50,"c1_id":53,"c2_id":42,"cost":13,"c1_x":470,"c1_y":610,"c2_x":540,"c2_y":659,"owned":false},{"id":51,"c1_id":42,"c2_id":6,"cost":10,"c1_x":540,"c1_y":659,"c2_x":510,"c2_y":705,"owned":false},{"id":52,"c1_id":6,"c2_id":53,"cost":16,"c1_x":510,"c1_y":705,"c2_x":470,"c2_y":610,"owned":true},{"id":53,"c1_id":6,"c2_id":13,"cost":13,"c1_x":510,"c1_y":705,"c2_x":433,"c2_y":673,"owned":false},{"id":54,"c1_id":53,"c2_id":13,"cost":15,"c1_x":470,"c1_y":610,"c2_x":433,"c2_y":673,"owned":false},{"id":55,"c1_id":13,"c2_id":51,"cost":15,"c1_x":433,"c1_y":673,"c2_x":408,"c2_y":623,"owned":false},{"id":56,"c1_id":51,"c2_id":25,"cost":16,"c1_x":408,"c1_y":623,"c2_x":338,"c2_y":693,"owned":false},{"id":57,"c1_id":25,"c2_id":28,"cost":11,"c1_x":338,"c1_y":693,"c2_x":298,"c2_y":675,"owned":false},{"id":58,"c1_id":28,"c2_id":50,"cost":8,"c1_x":298,"c1_y":675,"c2_x":282,"c2_y":710,"owned":false},{"id":59,"c1_id":50,"c2_id":23,"cost":12,"c1_x":282,"c1_y":710,"c2_x":210,"c2_y":699,"owned":false},{"id":60,"c1_id":40,"c2_id":52,"cost":11,"c1_x":350,"c1_y":585,"c2_x":314,"c2_y":639,"owned":false},{"id":61,"c1_id":52,"c2_id":28,"cost":10,"c1_x":314,"c1_y":639,"c2_x":298,"c2_y":675,"owned":false},{"id":62,"c1_id":41,"c2_id":11,"cost":12,"c1_x":304,"c1_y":461,"c2_x":232,"c2_y":490,"owned":true},{"id":63,"c1_id":11,"c2_id":21,"cost":9,"c1_x":232,"c1_y":490,"c2_x":230,"c2_y":513,"owned":true},{"id":64,"c1_id":55,"c2_id":21,"cost":15,"c1_x":270,"c1_y":573,"c2_x":230,"c2_y":513,"owned":true},{"id":65,"c1_id":55,"c2_id":46,"cost":9,"c1_x":270,"c1_y":573,"c2_x":240,"c2_y":596,"owned":false},{"id":66,"c1_id":46,"c2_id":24,"cost":19,"c1_x":240,"c1_y":596,"c2_x":170,"c2_y":560,"owned":true},{"id":67,"c1_id":21,"c2_id":3,"cost":11,"c1_x":230,"c1_y":513,"c2_x":150,"c2_y":528,"owned":true},{"id":68,"c1_id":3,"c2_id":24,"cost":13,"c1_x":150,"c1_y":528,"c2_x":170,"c2_y":560,"owned":false},{"id":69,"c1_id":24,"c2_id":20,"cost":12,"c1_x":170,"c1_y":560,"c2_x":112,"c2_y":567,"owned":false},{"id":70,"c1_id":20,"c2_id":38,"cost":12,"c1_x":112,"c1_y":567,"c2_x":38,"c2_y":553,"owned":true},{"id":71,"c1_id":24,"c2_id":44,"cost":22,"c1_x":170,"c1_y":560,"c2_x":61,"c2_y":661,"owned":false},{"id":72,"c1_id":38,"c2_id":44,"cost":16,"c1_x":38,"c1_y":553,"c2_x":61,"c2_y":661,"owned":true},{"id":73,"c1_id":59,"c2_id":30,"cost":16,"c1_x":350,"c1_y":344,"c2_x":340,"c2_y":425,"owned":false},{"id":74,"c1_id":30,"c2_id":41,"cost":12,"c1_x":340,"c1_y":425,"c2_x":304,"c2_y":461,"owned":false},{"id":75,"c1_id":30,"c2_id":18,"cost":12,"c1_x":340,"c1_y":425,"c2_x":350,"c2_y":499,"owned":true}]; 
var trainData = [{"player_number":2,"id":2,"type":"STANDARD","game_player_id":2,"game_id":1,"player_id":0,"route_id":18,"origin_city_id":58,"dest_city_id":17,"track_unit":3,"direction":"_","line":"RED","status":"ENROUTE","goods":[{"train_id":2,"goods_id":31,"name":"Furniture"},{"train_id":2,"goods_id":7,"name":"Chocolate"}]},{"player_number":3,"id":3,"type":"STANDARD","game_player_id":3,"game_id":1,"player_id":0,"route_id":30,"origin_city_id":9,"dest_city_id":29,"track_unit":2,"direction":"_","line":"RED","status":"ENROUTE","goods":[{"train_id":3,"goods_id":19,"name":"Marble"}]},{"player_number":5,"id":4,"type":"STANDARD","game_player_id":4,"game_id":1,"player_id":0,"route_id":5,"origin_city_id":49,"dest_city_id":56,"track_unit":2,"direction":"_","line":"RED","status":"ENROUTE","goods":[]},{"player_number":4,"id":5,"type":"STANDARD","game_player_id":5,"game_id":1,"player_id":0,"route_id":1,"origin_city_id":56,"dest_city_id":43,"track_unit":0,"direction":"_","line":"RED","status":"ARRIVED","goods":[]},{"player_number":1,"id":15,"type":"STANDARD","game_player_id":1,"game_id":1,"player_id":1,"route_id":67,"origin_city_id":21,"dest_city_id":3,"track_unit":8,"direction":"+","line":"RED","status":"ARRIVED","goods":[{"train_id":15,"goods_id":29,"name":"Timber"},{"train_id":15,"goods_id":2,"name":"Ale"},{"train_id":15,"goods_id":38,"name":"Optical Instruments"}]}]; 
var routeCount = [routeData.length]; 
var train = []; 
var trackColor = "#888"; 
for(var i = 0; i < routeData.length; i++) { 
    var trainCount = 0; 
    train = []; 
    routeCount[i] = []; 
    routeCount[i].route_id = routeData[i].id; 
    trackColor = routeData[i].owned ? "#555" : "#888"; 
    for(var j = 0; j < trainData.length; j++) { 
    if(trainData[j].route_id == i) { 
     train[trainCount] = trainData[j]; 
     trainCount++; 
    } 
    } 
    drawTrack(routeData[i]["c1_y"], 
         routeData[i]["c1_x"], 
         routeData[i]["c2_y"], 
         routeData[i]["c2_x"], 
         trackColor, 
         train); 
} 
var cityGoods = [{"city_id":17,"city_name":"Florence","city_x":521,"city_y":511,"goods_index":1,"goods_image":["goods_icon_marble.gif"],"goods_name":["Marble"]},{"city_id":19,"city_name":"Glasgow","city_x":101,"city_y":285,"goods_index":2,"goods_image":["goods_icon_computers.gif","goods_icon_wool.gif"],"goods_name":["Computers","Wool"]},{"city_id":30,"city_name":"Luxembourg","city_x":340,"city_y":425,"goods_index":1,"goods_image":["goods_icon_computers.gif"],"goods_name":["Computers"]},{"city_id":32,"city_name":"Manchester","city_x":192,"city_y":308,"goods_index":2,"goods_image":["goods_icon_computers.gif","goods_icon_auto.gif"],"goods_name":["Computers","Autos"]},{"city_id":45,"city_name":"Stuttgart","city_x":370,"city_y":504,"goods_index":2,"goods_image":["goods_icon_computers.gif","goods_icon_auto.gif"],"goods_name":["Computers","Autos"]},{"city_id":52,"city_name":"Wroclaw","city_x":314,"city_y":639,"goods_index":1,"goods_image":["goods_icon_computers.gif"],"goods_name":["Computers"]},{"city_id":13,"city_name":"Budapest","city_x":433,"city_y":673,"goods_index":1,"goods_image":["goods_icon_aluminum.gif"],"goods_name":["Aluminum"]},{"city_id":11,"city_name":"Bremen","city_x":232,"city_y":490,"goods_index":1,"goods_image":["goods_icon_auto.gif"],"goods_name":["Autos"]},{"city_id":14,"city_name":"Cardiff","city_x":232,"city_y":257,"goods_index":1,"goods_image":["goods_icon_auto.gif"],"goods_name":["Autos"]},{"city_id":20,"city_name":"Goteburg","city_x":112,"city_y":567,"goods_index":1,"goods_image":["goods_icon_auto.gif"],"goods_name":["Autos"]},{"city_id":34,"city_name":"Munich","city_x":400,"city_y":532,"goods_index":1,"goods_image":["goods_icon_auto.gif"],"goods_name":["Autos"]},{"city_id":36,"city_name":"Naples","city_x":650,"city_y":584,"goods_index":1,"goods_image":["goods_icon_auto.gif"],"goods_name":["Autos"]},{"city_id":47,"city_name":"Turin","city_x":479,"city_y":431,"goods_index":1,"goods_image":["goods_icon_auto.gif"],"goods_name":["Autos"]},{"city_id":8,"city_name":"Bilbao","city_x":495,"city_y":202,"goods_index":1,"goods_image":["goods_icon_wool.gif"],"goods_name":["Wool"]},{"city_id":15,"city_name":"Cork","city_x":195,"city_y":166,"goods_index":1,"goods_image":["goods_icon_wool.gif"],"goods_name":["Wool"]},{"city_id":24,"city_name":"Copenhagen","city_x":170,"city_y":560,"goods_index":1,"goods_image":["goods_icon_engines.gif"],"goods_name":["Engines"]},{"city_id":33,"city_name":"Marseille","city_x":530,"city_y":373,"goods_index":1,"goods_image":["goods_icon_engines.gif"],"goods_name":["Engines"]},{"city_id":40,"city_name":"Prague","city_x":350,"city_y":585,"goods_index":1,"goods_image":["goods_icon_engines.gif"],"goods_name":["Engines"]},{"city_id":4,"city_name":"Barcelona","city_x":572,"city_y":282,"goods_index":1,"goods_image":["goods_icon_fruit.gif"],"goods_name":["Fruit"]},{"city_id":43,"city_name":"Seville","city_x":658,"city_y":68,"goods_index":1,"goods_image":["goods_icon_fruit.gif"],"goods_name":["Fruit"]},{"city_id":49,"city_name":"Valencia","city_x":605,"city_y":217,"goods_index":2,"goods_image":["goods_icon_fruit.gif","goods_icon_silk.gif"],"goods_name":["Fruit","Silk"]},{"city_id":31,"city_name":"Lyon","city_x":450,"city_y":370,"goods_index":1,"goods_image":["goods_icon_silk.gif"],"goods_name":["Silk"]}]; 
    drawCityGoods(cityGoods); 
var cities = [{"id":1,"name":"Aberdeen","x":70,"y":330,"image":""},{"id":2,"name":"Antwerpen","x":290,"y":400,"image":""},{"id":3,"name":"Arhus","x":150,"y":528,"image":""},{"id":4,"name":"Barcelona","x":572,"y":282,"image":""},{"id":5,"name":"Belfast","x":131,"y":243,"image":""},{"id":6,"name":"Belgrade","x":510,"y":705,"image":""},{"id":7,"name":"Bern","x":430,"y":432,"image":""},{"id":8,"name":"Bilbao","x":495,"y":202,"image":""},{"id":9,"name":"Birmingham","x":209,"y":300,"image":""},{"id":10,"name":"Bordeaux","x":448,"y":250,"image":""},{"id":11,"name":"Bremen","x":232,"y":490,"image":""},{"id":12,"name":"Brussels","x":299,"y":395,"image":""},{"id":13,"name":"Budapest","x":433,"y":673,"image":""},{"id":14,"name":"Cardiff","x":232,"y":257,"image":""},{"id":15,"name":"Cork","x":195,"y":166,"image":""},{"id":16,"name":"Dublin","x":170,"y":225,"image":""},{"id":17,"name":"Florence","x":521,"y":511,"image":""},{"id":18,"name":"Frankfurt","x":350,"y":499,"image":""},{"id":19,"name":"Glasgow","x":101,"y":285,"image":""},{"id":20,"name":"Goteburg","x":112,"y":567,"image":""},{"id":21,"name":"Hamburg","x":230,"y":513,"image":""},{"id":22,"name":"Holland","x":255,"y":412,"image":""},{"id":23,"name":"Kalningrad","x":210,"y":699,"image":""},{"id":24,"name":"Copenhagen","x":170,"y":560,"image":""},{"id":25,"name":"Krakow","x":338,"y":693,"image":""},{"id":26,"name":"Leipzig","x":300,"y":554,"image":""},{"id":27,"name":"Lisbon","x":571,"y":10,"image":""},{"id":28,"name":"Lodz","x":298,"y":675,"image":""},{"id":29,"name":"London","x":260,"y":314,"image":""},{"id":30,"name":"Luxembourg","x":340,"y":425,"image":""},{"id":31,"name":"Lyon","x":450,"y":370,"image":""},{"id":32,"name":"Manchester","x":192,"y":308,"image":""},{"id":33,"name":"Marseille","x":530,"y":373,"image":""},{"id":34,"name":"Munich","x":400,"y":532,"image":""},{"id":35,"name":"Nantes","x":372,"y":250,"image":""},{"id":36,"name":"Naples","x":650,"y":584,"image":""},{"id":37,"name":"Newcastle","x":155,"y":315,"image":""},{"id":38,"name":"Oslo","x":38,"y":553,"image":""},{"id":39,"name":"Porto","x":510,"y":53,"image":""},{"id":40,"name":"Prague","x":350,"y":585,"image":""},{"id":41,"name":"Ruhr","x":304,"y":461,"image":""},{"id":42,"name":"Sarajevo","x":540,"y":659,"image":""},{"id":43,"name":"Seville","x":658,"y":68,"image":""},{"id":44,"name":"Stockholm","x":61,"y":661,"image":""},{"id":45,"name":"Stuttgart","x":370,"y":504,"image":""},{"id":46,"name":"Szczecin","x":240,"y":596,"image":""},{"id":47,"name":"Turin","x":479,"y":431,"image":""},{"id":48,"name":"Toulouse","x":504,"y":293,"image":""},{"id":49,"name":"Valencia","x":605,"y":217,"image":""},{"id":50,"name":"Warsaw","x":282,"y":710,"image":""},{"id":51,"name":"Vienna","x":408,"y":623,"image":""},{"id":52,"name":"Wroclaw","x":314,"y":639,"image":""},{"id":53,"name":"Zagreb","x":470,"y":610,"image":""},{"id":54,"name":"Zurich","x":430,"y":462,"image":""},{"id":55,"name":"Berlin","x":270,"y":573,"image":""},{"id":56,"name":"Madrid","x":568,"y":149,"image":""},{"id":57,"name":"Milan","x":479,"y":466,"image":""},{"id":58,"name":"Rome","x":598,"y":527,"image":""},{"id":59,"name":"Paris","x":350,"y":344,"image":""},{"id":60,"name":"Venice","x":484,"y":527,"image":""}]; 
for(key in cities) { 
    var cityLink = "http://apps.facebook.com/rails_across_europe/turn/start_set_city?city_id="+cities[key]["id"]; 
    cities[key]["city_id"] = cities[key]["id"]; 
    cities[key]["city_name"] = cities[key]["name"]; 
    cities[key]["city_x"] = cities[key]["x"]; 
    cities[key]["city_y"] = cities[key]["y"]; 
    cities[key]["city_link"] = cityLink; 
} drawCities(cities); 
    param = { "routes": [{ "id": 1, "count": 9},{ "id": 2, "count": 14},{ "id": 3, "count": 10},{ "id": 4, "count": 8},{ "id": 5, "count": 7},{ "id": 6, "count": 7},{ "id": 7, "count": 5},{ "id": 8, "count": 7},{ "id": 9, "count": 6},{ "id": 10, "count": 12},{ "id": 11, "count": 8},{ "id": 12, "count": 8},{ "id": 13, "count": 6},{ "id": 14, "count": 8},{ "id": 15, "count": 4},{ "id": 16, "count": 7},{ "id": 17, "count": 4},{ "id": 18, "count": 8},{ "id": 19, "count": 6},{ "id": 20, "count": 5},{ "id": 21, "count": 5},{ "id": 22, "count": 10},{ "id": 23, "count": 10},{ "id": 24, "count": 9},{ "id": 25, "count": 6},{ "id": 26, "count": 1},{ "id": 27, "count": 4},{ "id": 28, "count": 10},{ "id": 29, "count": 6},{ "id": 30, "count": 6},{ "id": 31, "count": 2},{ "id": 32, "count": 9},{ "id": 33, "count": 6},{ "id": 34, "count": 4},{ "id": 35, "count": 6},{ "id": 36, "count": 5},{ "id": 37, "count": 5},{ "id": 38, "count": 5},{ "id": 39, "count": 5},{ "id": 40, "count": 2},{ "id": 41, "count": 6},{ "id": 42, "count": 7},{ "id": 43, "count": 10},{ "id": 44, "count": 10},{ "id": 45, "count": 3},{ "id": 46, "count": 5},{ "id": 47, "count": 6},{ "id": 48, "count": 9},{ "id": 49, "count": 7},{ "id": 50, "count": 7},{ "id": 51, "count": 5},{ "id": 52, "count": 10},{ "id": 53, "count": 8},{ "id": 54, "count": 7},{ "id": 55, "count": 5},{ "id": 56, "count": 7},{ "id": 57, "count": 4},{ "id": 58, "count": 4},{ "id": 59, "count": 8},{ "id": 60, "count": 6},{ "id": 61, "count": 4},{ "id": 62, "count": 8},{ "id": 63, "count": 3},{ "id": 64, "count": 6},{ "id": 65, "count": 3},{ "id": 66, "count": 7},{ "id": 67, "count": 8},{ "id": 68, "count": 4},{ "id": 69, "count": 6},{ "id": 70, "count": 8},{ "id": 71, "count": 11},{ "id": 72, "count": 11},{ "id": 73, "count": 9},{ "id": 74, "count": 4},{ "id": 75, "count": 8}] }; 
    var ajax = new Ajax(); 
    ajax.post("http://railsacrosseurope.com/turn/update_track", param); 
</script> 
+2

對此不起作用? – 2009-09-15 01:58:02

+0

爲什麼要支持IE6? IE6用戶對您的網站有足夠的需求需要支持嗎? – 2009-09-15 02:19:16

+0

Cory,js應該繪製城市並在地圖上跟蹤。這沒有發生。 詹姆斯,我升級到v8,我仍然有問題。 – 2009-09-15 02:46:11

回答

0

如果沒有一些JS庫工作,因爲我可以看到你不,我sugest訪問下面的網站,並檢查你的代碼,而解決已報告這些錯誤。這可能會讓你對發生的事情有所瞭解。

http://jslint.com/

+0

謝謝GaVrA。我去做。 – 2009-09-15 03:02:50

0

通過jslint運行你的代碼,我得到這個警告

Problem at line 32 character 5: Bad for in variable 'key'. 

可能是一個DOM全局​​變量或東西。改變它,看看會發生什麼。此外,你的for..in循環不會做它應該的。它用於遍歷對象屬性,而不是通過數組的元素。使用帶索引的普通循環。

+0

'for(關鍵城市)'工作得很好。我在IE6中測試過。也許他如何在'drawCities()'中使用'cities'不起作用? – 2009-09-15 01:59:52

+0

是的,在這種情況下,它可能工作正常,但總的來說,這是一個壞主意。看到這個https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Statements/for...in – 2009-09-15 02:04:00

+0

Chetan,謝謝你指出。我不像我應該那樣熟悉JS最佳實踐。我會糾正這一點。 – 2009-09-15 03:20:53

1

我發現了這個問題。它不在這裏列出的代碼中。我已經將一些變量聲明爲'不能識別的'const',並且我還在使用索引for循環替換的數組上使用for..in構造。一旦我在IE8中發現了js調試器,一切就都到位了。這大大加速了事情!現在一切都看起來不錯。感謝所有的幫助。