2
このコードを実行すると、ページがロードされないのはなぜですか?常にブラウザタブに接続して表示されます。このWebページの読み込みが完了しないのはなぜですか?
アラートボックスを表示し、文書全体を単語テストに変更するシンプルなjavascriptです。
Javascriptを - testQuery.js
(function (window, undefined) {
var testQuery = function(obj) {
if (!(this instanceof testQuery)) {
return new testQuery(obj);
}
}
testQuery.alertMessage = function() {
alert("alert");
document.write("testing");
};
window.testQuery = testQuery;
}) (window);
HTML - testQuery.html
<html>
<head>
<script src="testQuery.js"></script>
<script>
function onClick() {
testQuery.alertMessage();
}
</script>
</head>
ありがとう。出来た。近くが必要であることに気付かなかった。 –
@simplified理論的には 'document.open'も必要ですが、' document.write'は既存の文書がすでに閉じられている場合は新しい文書を開きます。 – Raynos
ありがとうございます。理論的には、フローをより完全に見せてくれることを意味します。 –