【发布时间】:2011-02-21 03:15:01
【问题描述】:
尝试学习如何使用 yql execute 解析页面。我想分别返回文本和图像。我还想更改所有图像的宽度。试图为此编写javascript,但它不起作用。谁能指出我正确的方向?
<execute><![CDATA[ var q = y.query('select * from html where url=@url and xpath=@xpath',{url:url,xpath:xpath}); var myresults = q.results; var images = myresults.getElementsByTagName('img'); images.setAttribute('width','150'); text = myresults.getElementById("p").textContent; response.object = <text>{text}</text> <images>{images}</images>; ]]> </execute>
【问题讨论】:
标签: javascript yql