Jump to content
Rila_xp

jQuery not work in ie

Recommended Posts

Posted

Am codul urmator,care nu vrea sa imi functioneze deloc in ie,in firefox merge perfect!

Pareri,idei?Ce sa ii fac?

<html>
<? require_once("users.php"); ?>
<head>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />



<title>Chat</title>

<link rel="stylesheet" href="style.css" type="text/css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>

<script>
function Chat () {

this.send = sendChat;
this.load = load();

}

//gets the state of the chat



//send the message
function sendChat(message, nickname)
{

$.ajax({
type: 'POST',
url: 'process.php',
data: {
'function': 'send',
'message': message
},
success: function(data){
load();
},
});

}
function load () {
$(setInterval(function() {
$('#chat-area').load('refresh.php');
$("#chat-area").attr({ scrollTop: $('#chat-area').attr('scrollHeight') });
}, 1500));
}
var chat = new Chat();

jQuery(function() {



// watch textarea for key presses
$("#sendie").keydown(function(event) {

var key = event.which;

//all keys including return.
if (key >= 33) {

var maxLength = $(this).attr('maxlength');
var length = this.value.length;

// don't allow new content if length is maxed out
if (length >= maxLength) {
event.preventDefault();
}
} });
// watch textarea for release of key press
$('#sendie').keyup(function(e) {

if (e.keyCode == 13) {

var text = $(this).val();
var maxLength = $(this).attr('maxlength');
var length = text.length;

// send
if (length <= maxLength + 1) {

chat.send(text, name);
$(this).val("");

} else {

$(this).val(text.substring(0, maxLength));

}


}
});

});
</script>

</head>
<body onload="setInterval('load()', 1000)">

<div id="page-wrap">

<h2>Chat</h2>

<p id="name-area"></p>

<div id="chat-wrap"><div id="chat-area"></div></div>
<?
session_start();
if(isset($_SESSION['nume'])){
?>
<form id="send-message-area">
<p>Your message: </p>
<textarea id="sendie" maxlength = '300' ></textarea>
</form>
<?
}else{
echo"<center>";
echo "<h1><form action='' method='post'>Daca vrei sa vorbesti pe chat introdu un nickname! <input type='text' name='nume' /><br /><input type='submit' value='Submit' /></form></h1>";
if($_POST['nume']==='')
{
}else{
$_SESSION['nume']=$_POST['nume'];
}
echo"</center>";
}
?>

</div>

</body>

</html>

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...