Как когато е празез input-a с id usermsg да ти изкарва едно прозорче в което да има само OK и мое съобщение?
Това ми е JS
Това ми е JS
Код:
$(function () {
$("#submitmsg").click(function() {
var message = $("#usermsg").val();
$.post("post.php", {text: message});
$("#usermsg").attr("value", "");
return false;
});
function loadLog() {
var oldScrollHeight = $("#chatbox").attr("scrollHeight") - 20;
$.ajax({
url: "log.html",
cashe: false,
success: function(html) {
$("#chatbox").html(html);
var newscrollHeight = $("#chatbox").attr("scrollHeight") - 20;
if(newscrollHeight> oldScrollHeight) {
$("#chatbox").animate({ scrollTop: newscrollHeight}, 'slow')
}
}
});
}
setInterval(loadLog, 1000);
$("#exit").click(function() {
var exit = confirm("Сигурни ли сте, че искате да излезете от чата ?");
if(exit == true) {
window.location = 'chats.php?logout=true';
}
});
});