「新規行番号入力」の版間の差分

MSY-07 (トーク | 投稿記録)
ソースコードを整形
MSY-07 (トーク | 投稿記録)
処理の順番を変更(ダイアログボックスで [キャンセル] ボタンを押すと文書が全消去されるため)
8行目: 8行目:
=== ソースコード ===
=== ソースコード ===
<syntaxhighlight lang="javascript" copy>
<syntaxhighlight lang="javascript" copy>
var r = new RegExp(prompt("整数2桁までを入力してください", ""));
// 全消去
// 全消去
document.selection.SelectAll();
document.selection.SelectAll();
document.selection.DeleteLeft(1);
document.selection.DeleteLeft(1);


var r = new RegExp(prompt("整数2桁までを入力してください", ""));
// 値の取得
// 値の取得
document.selection.Text = r;
document.selection.Text = r;
55行目: 56行目:
}
}


Document.Text = str.replace(/\n$/, "");
document.Text = str.replace(/\n$/, "");
}
}
</syntaxhighlight>
</syntaxhighlight>
スポンサーリンク