指定したidのiframeのdocumentを取得する関数 function getIframeDoc(iframeId){ var iframe = document.getElementById(iframeId); if (document.all) { return iframe.contentWindow.document; } else { return iframe.contentDocument; } } こんな感じで適当なdivを作って適当なiframeを放り込んで、body作ってDOM操作できるようにしてやる。 var div = document.createElement('div'); div.id = 'iframeContainer'; document.body.appendChild(div); var iframe = document.createEl
2009年02月25日17:30 カテゴリLightweight Languages javascript - eval(insecure.code).safely with(jail); //でもIEが きっかけは、これ。 JavaScript: The Good Parts Douglas Crockford / 水野貴明訳 [原著:JavaScript: The Good Parts] Twitter / javascripter: JSON.parseよりeval("(" + str ...JSON.parseよりeval("(" + str + ")")のほうが5〜10倍くらい早いけどなんなんだろう。 eval("(" + str + ")")のなにがまずいかは、「JavaScript: The Good Parts」を読んでいただくとして.... んじゃ、eval用のsandb
HTMLと解釈される文字文字列を画面に表示するときはその文字をエスケープしないといけない。 ・・・そのやり方 prototype.jsに面白いやりかたがのってたのでそれを単体で切り出すと↓こういう感じになる //htmlな文字をエスケープ var escapeHTML = function(_strTarget){ var div = document.createElement('div'); var text = document.createTextNode(''); div.appendChild(text); text.data = _strTarget; return div.innerHTML; } 何かHTML要素の中のテキストノードにエスケープされていない文字列を突っ込んで、それを要素のinnerHTMLとして取り出すと、エスケープされた文字列を得ることができる。 タ
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く