JavaScript: 2007年11月アーカイブ
先のエントリーにて、ソース表示に用いている blockquote タグのCSSを修正した件について書いたが、今度はソースの一覧性・視認性に問題があるような気がして、サポート用のスクリプト(JavaScript)を追加してみた。
var btnWrite = "<input type=\"button\" onclick=\"selwin(this);\" value=\"copy用ウィンドウ\"><p> </p>";
var t;
var s;
function selwin(o){
var p = o.parentNode;
var c = p.childNodes;
for(i=0;c.length>i;i++){
if(c[i].tagName){
if(c[i].tagName == "BLOCKQUOTE"){
t = c[i].innerHTML;
s = window.open('','s','width=400,height=400,menubar=no,toolbar=no,location=no,status=no,scrollbars=yes,resizable=yes');
setTimeout("wr();",1000);
}
}
}
}
function wr(){
if(!window.s.closed){
window.s.document.body.innerHTML = t;
window.s.document.title="コピー用ウィンドウ";
}
}
function wb(){
document.write(btnWrite);
}
ソース表示用スクリプトの続きを読む
