2012-07-23 49 views
0

這裏是我在我的網站中使用的代碼。出於某種原因,我什麼都得不到Ustream狀態代碼是否損壞?

<div style="position:absolute; left:0px; top:0px; width:1200px; height:63px; opacity: 0;" ondrag="return false"; ondragstart="return false"; oncontextmenu="return false;""> 

    <img src="wpimages/wpa570f7e0.png" width="1200" height="63" border="0" id="statuslive" name="statuslive" title="" alt="" onload="OnLoadPngFix()" > 
</div> 


<script src="http://code.jquery.com/jquery-latest.js"></script> 
<style> 
    #statuslive { 
     display: block; 
     position: fixed; 
     left: 0; 
     top: 0; 
     width: 100%; 
     z-index: 100001; 
     padding: 0; 
    } 
</style> 
<script> 
    var query = 'http://api.ustream.tv/json/channel/codtelevision/getValueOf/status?key=my key only'; 

    function run() { 
     $.getJSON(query, function (data) { 
      if (data['results'] == 'live') { 
       document.getElementById("statuslive").style.opacity = "1"; 
       alert('Live'); 
      } else { 
       document.getElementById("statuslive").style.opacity = "0"; 
       alert('Offline'); 
      } 
     }); 
     clearTimeout(to); 
     setTimeout(run, 1000); 
    } 
    run(); 
</script>​​​​​ 

即使我活着,圖像也不會顯示。我曾嘗試使用最新版本的jquery,但我仍然沒有形象。

這是我得到:

{"results":"offline","msg":null,"error":null,"processTime":true,"version":"mashery-r10"} 
+0

目前尚不清楚你實際上問。您是否從供應商那裏獲得意外的數據?這是你應該與供應商覈對的東西嗎?如果代碼本身出乎意料地行爲,請指出數據的位置和位置。 – David 2012-07-23 20:21:33

+0

對不起,當我真的活的時候,圖像沒有出現。爲什麼人們低估了我的問題..我真的需要幫助 – 2012-07-23 20:23:03

+0

降低價值可能是由於你對這個問題的困惑。在這種情況下,供應商回來的數據是什麼?你說你的圖片沒有顯示。但該圖像的條件取決於從外部源返回的數據。這些數據是什麼? 「a ==」是否居住「'?如果不是,什麼是'a'?如果您不提供更多信息,我們無法幫助您。 – David 2012-07-23 20:33:25

回答

0

嘗試執行對DOM準備的run功能。
相反的函數調用

run(); 

寫的:

$(document).ready(function(){ 
    run(); 
}); 
+0

你是什麼意思...你能告訴我在哪裏把我的代碼? – 2012-07-23 20:53:08

+0

仍然沒有工作 – 2012-07-23 20:58:16