count a and img
by
june29
2010-05-21 [2010/05/21 12:14:23]
Count all 'a' tags and 'img' in target HTML
-
/*
* @title count a and img
* @description Count all 'a' tags and 'img' in target HTML
* @include http://*
* @include https://*
* @license MIT License
* @require
*/
(function() {
var links = document.getElementsByTagName("a");
var images = document.getElementsByTagName("img");
var display = document.createElement("div");
display.setAttribute("style", "font-size: 300%; color: #000; background-color: #fff; text-align: center; padding: 10px;");
display.innerHTML = "a: " + links.length + ", img: " + images.length;
document.body.insertBefore(display, document.body.firstChild);
})();
-
- Permalink
- このページへの個別リンクです。
- RAW
- 書かれたコードへの直接のリンクです。
- Packed
- 文字列が圧縮された書かれたコードへのリンクです。
- Userscript
- Greasemonkey 等で利用する場合の .user.js へのリンクです。
- Loader
- @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
- Metadata
- コード中にコメントで @xxx と書かれたメタデータの JSON です。