Mail.ruПочтаМой МирОдноклассникиВКонтактеИгрыЗнакомстваНовостиКалендарьОблакоЗаметкиВсе проекты

Не работает JS

Па Раша Мастер (2334), на голосовании 11 лет назад
<html>
<head>
<title>Empty title</title>
<script></script>
<link>
</head>

<body>
<script>
$(document).ready(function() {
setTimeout(function() {
$("#myDiv2").text('Please, type a title into the form below and press the "Change the title" button');
$("#myDiv2").removeClass().addClass('neutralDiv');
}, 500);
$("#txtTitle").focusin(function() {
$("#txtTitle").attr("placeholder", "");
if ($("#txtTitle").attr("value") != '') {
var x = $("#txtTitle").attr("value").length;
var y = $("#txtTitle").attr("maxlength");
$("#myDiv2").text('The title is being typed ('+(y-x)+' symbols left)');
};
$("#txtTitle").keydown(function() {
setTimeout(function() {
var x = $("#txtTitle").attr("value").length;
var y = $("#txtTitle").attr("maxlength");
if (x == 0) {
$("#myDiv2").text('Please, type a title into the form below and press the "Change the title" button')
}
else {
$("#myDiv2").text("The title is being typed ("+(y-x)+" symbols left)")
};
}, 10);
});
});
$("#txtTitle").focusout(function() {
$("#txtTitle").attr("placeholder", "Type a new title here");
});
$("#myDiv").submit(function changeTitle() {
if ($("#btnTitle").attr("value") != "Change the title") {
$("#myDiv2").removeClass().addClass('errorDiv');
$("#myDiv2").text('Wait until the program is ready for manipulations');
return false;
}
else if ($("#txtTitle").attr("value") == "") {
$("#btnTitle").attr("value", "Error");
$("#btnTitle").removeClass().addClass('errorButton');
$("#myDiv2").text('You have typed no title');
$("#myDiv2").removeClass().addClass('errorDiv');
document.title = "Empty title";
setTimeout(function() {
$("#btnTitle").attr("value", "Change the title");
$("#btnTitle").removeClass().addClass('neutralButton');
$("#myDiv2").text('Please, type a title into the form below and press the "Change the title" button');
$("#myDiv2").removeClass().addClass('neutralDiv');
}, 3000);
}
else if (document.title == $("#txtTitle").attr("value")) {
$("#btnTitle").attr("value", "Error");
$("#btnTitle").removeClass().addClass('errorButton');
$("#myDiv2").text('You have typed the same title as setted');
$("#myDiv2").removeClass().addClass('errorDiv');
setTimeout(function() {
$("#btnTitle").attr("value", "Change the title");
$("#btnTitle").removeClass().addClass('neutralButton');
$("#myDiv2").text('Please, type a title into the form below and press the "Change the title" button');
$("#myDiv2").removeClass().addClass('neutralDiv');
}, 3000);
}
else {
document.title = $("#txtTitle").attr("value");
$("#btnTitle").attr("value", "Done");
$("#btnTitle").removeClass().addClass('successButton');
$("#myDiv2").text('Title has been successfully changed');
$("#myDiv2").removeClass().addClass('successDiv');
setTimeout(function() {
$("#btnTitle").attr("value", "Change the title");
$("#btnTitle").removeClass().addClass('neutralButton');
$("#myDiv2").text('Please, type a title into the form below and press the "Change the title" button');
$("#myDiv2").removeClass().addClass('neutralDiv');
}, 3000);
};
return false;
});
$("#browserInfo").click(function() {
alert('<?php
$ip = $_SERVER["REMOTE_ADDR"];
echo $ip;
?>');
return false;
});
});
</script>
<form>
<br/>
<input>
<br/>

<br/>
<input>
Дополнен 11 лет назад
Не работает данный JS скрипт при включенной в браузереподдержке Javascript.
Кто знает в чем дело?
Может в скрипте ошибка?
Голосование за лучший ответ
Imobilazer Искусственный Интеллект (222379) 11 лет назад
1. Это JQuery, а не JS
2. Не вижу подключения файлов JQuery в хеадере.
Па РашаМастер (2334) 11 лет назад
JQuery - это как раз один из модулей JS.
Он подключен, просто этот сайт почему-то не отображает написанные мною атрибуты.. Одни лишь лысые тэги.
Похожие вопросы