2011-08-05 38 views
0

Accuweather花粉数Googleアプリを使用すると、IEでエラーが発生します。ここでIEでのJavascriptエラー(getElementsByTagName(...)。item(...) 'がnullまたはオブジェクトではありません)

は、直接スクリプトへのリンクです:ここでは

http://www-igprev-opensocial.googleusercontent.com/gadgets/ifr?exp_rpc_js=1&exp_track_js=1&url=http%3A%2F%2Fwhapowllc.googlepages.com%2Fpollen.xml&container=igprev&view=default&lang=en&country=US&sanitize=0&v=45408d622dfd6df4&parent=http://www.google.com&libs=core:core.io:core.iglegacy:auth-refresh&is_signedin=1&synd=igprev&view=default

問題のサラウンドスクリプトです:

 function setContent(url) { 
     _IG_FetchXmlContent(url, function (response) { 
      if (!response) { 
       msg.createDismissibleMessage("Error loading location data. Please try again later."); 
       echoDefault(); 
      } else if (response.firstChild.nodeName != 'error' && 
       parseInt(response.getElementsByTagName('citylist').item(0).getAttribute('us')) 
       + parseInt(response.getElementsByTagName('citylist').item(0).getAttribute('intl')) 
       + parseInt(response.getElementsByTagName('citylist').item(0).getAttribute('extra_cities'))) { 
       mylocation = response.getElementsByTagName('location').item(0).getAttribute('location'); 
       url = 'http://whapw.accu-weather.com/widget/whapw/weather-data.asp?location=' + mylocation; 

       _IG_FetchXmlContent(url, function (response) { 
        if (!response) { 
         msg.createDismissibleMessage("Error loading pollen data. Please try again later."); 
         echoDefault(); 
        } else { 
         var tree = response.getElementsByTagName('tree').item(0).firstChild.nodeValue; 
         var weed = response.getElementsByTagName('weed').item(0).firstChild.nodeValue; 
         var grass = response.getElementsByTagName('grass').item(0).firstChild.nodeValue; 
         var mold = response.getElementsByTagName('mold').item(0).firstChild.nodeValue; 
         var airquality = response.getElementsByTagName('airquality').item(0).firstChild.nodeValue; 
         var airqualitytype = response.getElementsByTagName('airqualitytype').item(0).firstChild.nodeValue; 
         var airqualitystyle = ''; 

エラーがこの行から報告されています

} else if (response.firstChild.nodeName != 'error' && 
点の

作品FF/Chromeで罰金が、IEで私は取得しています:

Webページエラーの詳細

ユーザーエージェント:Mozillaの/ 4.0(互換; MSIE 8.0; Windows NT 6.1;トライデント/ 4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; 3M/MSIE 8.0) タイムスタンプ:金、2011年8月5日8時01分57秒UTC

Message: 'getElementsByTagName(...).item(...)' is null or not an object 
Line: 986 
Char: 12 
Code: 0 
URI: http://www-igprev-opensocial.googleusercontent.com/gadgets/ifr?exp_rpc_js=1&exp_track_js=1&url=http%3A%2F%2Fwhapowllc.googlepages.com%2Fpollen.xml&container=igprev&view=default&lang=en&country=US&sanitize=0&v=45408d622dfd6df4&parent=http://www.google.com&libs=core:core.io:core.iglegacy:auth-refresh&is_signedin=1&synd=igprev&view=default 

このエラーの原因となっているものの任意のアイデア?

ありがとうございます。

+2

コードの関連部分も追加してください。 –

+0

スクリプトは私が投稿したトップリンクにあります(私はJSにちょっと新しくなっていますので、コードの "関連する"部分が本当に何であるかは分かりません)。 –

+0

あなたを助けるためにリンクをたどる必要はありません(リンクが将来到達できない場合はどうなりますか?質問は無意味になります)。関連する部分は、エラーがスローされた行とその周囲のコードになります。このコード行は何でも依存します。 –

答えて

1

IEのいくつかのバージョンでは奇妙なことがあります。アイテム(0)は、最初のアイテムではなくNodeListの長さを返します。代わりに、インデックスを使用してアイテムにアクセスしてください:

+0

ありがとうございます、私はアイテム(0)を[0]に置き換えましたが、今は "位置情報の読み込み中にエラーが発生しました、もう一度やり直してください"と思われます。 ここでチェックすることができます:http://bit.ly/pSeSuC しかし、今IEで動作します。 –

+0

申し訳ありませんが、ミニスクリプトがいっぱいです。あなたが私にそれをデバッグしたいなら、あなたは私のレートが気に入らないかもしれません。 :-) – RobG

+0

私はそれが私のスクリプトロブではないことは怖いです、それは私がAccuweatherからGoogleのガジェットを引き出したものです!私はJavascriptではむしろ愚痴なのでコメントする立場にはいませんが、私はあなたの言葉をそれに服用します。ちょうどIEでそれを働かせることを本当に探しています。 –

関連する問題