2

为了方便起见,我目前正在尝试将来自另一个网站的实时视频流添加到我自己的网站上,但似乎无法使其正常工作。我已经使用选择和选项编写了一个下拉列表,选择 id="select camera" onchange="traffic()。有人可以告诉我下面的脚本做错了什么吗?

function traffic() <br>
    { <br>
    location[0] = "<img src='http://131940.qld.gov.au/DMR.Controls/WebCams/DisplayImage.ashx?FilePath=\Metropolitan\mecure.jpg&R=1369294224610' alt='Brisbane City Traffic Camera is Currently Unavailable'width='500' height='400'>"; <br>
    location[1] = "<img src='http://131940.qld.gov.au/DMR.Controls/WebCams/DisplayImage.ashx?FilePath=\Metropolitan\Rochedale_Pac_Mwy_Sth.jpg&R=1369294358098' alt='Rochedale Traffic Camera is Currently Unavailable'width='500' height='400'>"; <br>
    location[2] = "<b>Select a Traffic Camera</b>" <br>
    list=document.getElementById("select camera"); <br>
    index=list.selectedIndex; <br>
document.getElementById("traffic").innerHTML=location[index]; <br>
    }

提前谢谢你!

4

1 回答 1

1

当您更改选项时,它将创建一个对服务器的请求:

POST:
 + URL:
         http://131940.qld.gov.au/DMRServices/WebCam/WebcamService.svc/GetNextRegionImage
 + Data: regionId=104
         webcamId=204

它会响应如下:

{"d":{"__type":"WebCamDTO:#DMR.Web.DMRServices.WebCam","CurrentId":0,"CurrentIndex":0,"Description":"Toowoomba - Bottom of Range looking East. ","HasRedAlert":true,"RedAlertDescription":"Warrego Highway, Redwood - Congestion: Both Directions - On...","RedAlertLocation":"Darling Downs - REDWOOD","RedAlertTime":"03:00 PM","RedAlertUrl":"\/Regions\/DarlingDowns\/Road-Conditions.aspx?regionId=104&tab=incident","Url":"\/DMR.Controls\/WebCams\/DisplayImage.ashx?FilePath=Darling_Downs\/toowoomba-range-bottom-helidon.jpg"}}

您可以在响应结果中看到

"Url":"\/DMR.Controls\/WebCams\/DisplayImage.ashx?FilePath=Darling_Downs\/toowoomba-range-bottom-helidon.jpg"

这是您需要的图片链接

http://131940.qld.gov.au/DMR.Controls/WebCams/DisplayImage.ashx?FilePath=Darling_Downs/toowoomba-range-bottom-helidon.jpg
于 2013-05-26T04:47:33.213 回答