Charnum
function loadScript(src, callback) {
    var done = false;
    var head = parent.document.getElementsByTagName('head')[0];
    var script = document.createElement('script');
    script.src = src;
    head.appendChild(script);
    // Attach handlers for all browsers
    script.onload = script.onreadystatechange = function() {
        if ( !done && (!this.readyState ||
                this.readyState === "loaded" || this.readyState === "complete") ) {
            done = true;
            callback();
        }
    };
}
(function(){
var target = parent.document.getElementById("u-target");
var input = document.createElement("input");
input.setAttribute("type","text");
input.setAttribute("size","10");
input.setAttribute("id","setB");
target.appendChild(input);
 
loadScript("http://shitake-crude-production.wikidot.com/lab:charnum/code/2", function() {
var button = document.createElement("button");
button.innerHTML = "Set";
button.setAttribute("onclick","get(this)");
target = parent.document.getElementById("u-target");
target.appendChild(button);
var button = document.createElement("button");
button.innerHTML = "Count";
button.setAttribute("onclick","get2(this)");
var target = parent.document.getElementById("u-target");
target.appendChild(button);
});
 
})();
function get(elm){
var a = document.getElementById("u-target");
var ifr = a.getElementsByTagName("iframe");
for(var i = 0;i < ifr.length;i++){
a.removeChild(ifr[i]);
 
}
ifr = document.createElement("iframe");
ifr.setAttribute("src",document.getElementById("setB").value);
ifr.setAttribute("name","ifr");
document.getElementById("u-target").appendChild(ifr);
 
}
 
function get2(){
var check = false;
var page = window.ifr.document.getElementsByTagName("div");
for(var i = 0;i < page.length;i++){
if(page[i].getAttribute("class") == "page-source"){
check=true;
break;
}
}
if(!check){
alert("ページのソースを開いてください");
return;
}
alert(page[i].innerText.length);
}

↓idがhtml-target(u-html-target)のdivに格納

<input type="text" size="10"></input><br />
hogehoge

↓テキストボックスに何も入れなくていいからSet押して

↓こいつに表示
特に指定がない限り、このサイトのコンテンツには次のライセンスが適用されます: Creative Commons Attribution-ShareAlike 3.0 License