تبلیغات
<div id='messagesDiv'>

</div>



<textarea type='text'  name="my_textbox" id='messageInput' placeholder='Message...' style="scroll: 0; width:260px; height:30px;overflow:hidden;"></textarea>





<script>

  // Get a reference to the root of the chat data.
  var messagesRef = new Firebase('https://pjdt4159orz.firebaseio-demo.com/');

  // When the user presses enter on the message input, write the message to firebase.
  $('#messageInput').keypress(function (e) {
    if (e.keyCode == 13) {
      var name = getCookie("username");
if (name=="عطيه")
{var name="عطیه";}
if (name =="ی")
{
var text=" ";
}
else {
      var text = $('#messageInput').val();
messagesRef.push({name:name, text:text});
      $('#messageInput').val('');
}
      
    }
  });

  // Add a callback that is triggered for each chat message.
  messagesRef.limit(10).on('child_added', function (snapshot) {
    var message = snapshot.val();
    $('<div/>').text(message.text).prepend($('<em/>')
      .text(message.name+': ')).appendTo($('#messagesDiv'));
    $('#messagesDiv')[0].scrollTop = $('#messagesDiv')[0].scrollHeight;
  });

     
</script>
</div>