屏幕刮擦静态内容

时间:2012-10-01 23:18:31

标签: javascript screen-scraping

我在网站上有一个计数器,我想使用Javascript访问它。

我试图引用的代码如下所示:

<span id="counter">
0123 // This is the value I'm trying to access
</span>

轻松访问此值的最佳方法是什么?屏幕抓取似乎过于复杂。谢谢!

1 个答案:

答案 0 :(得分:1)

var el = document.getElementById('counter'),
    // innerText for IE, textContent for other browsers.
    value = el.textContent || el.innerText || '';
alert(value);
相关问题