Если я запускаю этот код, почему страница никогда не завершает загрузку? На вкладке моего браузера всегда будет отображаться соединение.
Это простой 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>