按enter键发送消息给聊天

时间:2016-01-08 22:56:41

标签: button chat enter

当我买了一个包时,我有一个模板网站,它有一个内置的聊天功能,但是你每次都需要按一个“发送”按钮发送聊天消息,这是使用的脚本,我猜它有点儿容易做到,但不擅长脚本:/

<div class="col-lg-4 border-left affix-items scrollbar" id="room-items">
<div id="dropboxy">
<?php
?>
</div>
</div>

<div class="col-lg-6 affix-players" style="padding:10px;">
<div id="playersdropboxy">
<?php include_once("players.php"); ?>
</div>
<div id="affix-players" class="scrollbar"> 
<div id="rooms"></div> </div> </div> <div class="col-lg-5 affix-right"> 
<div class="col-xs-24 chat"> <div class="row chat-container">

<div class="row chat-buttons"> <div class="col-xs-24"> <div class="media-body"> <div class="input-group"> 

<input type="text" class="form-control chat-message" id="text-massage" style="margin-left:6px;" maxlength="300"> <span class="input-group-btn"> 

<?php if(isset($_SESSION['steamid'])) { ?>
<button class="btn btn-primary" type="submit" data-loading-text="<i class='fa fa-spinner fa-spin'></i> WAIT..." id="send_massage" style="margin-right:6px;">SEND</button>

<div class="sml-bnt" id="smile"></div>
<? }
else { ?>
<form method="get" action="index.php"><input type="hidden" name="login" value=""/><input type="submit" class="btn btn-primary" value="Log in to chat" style="margin-right:6px;"/></form>

<?php }
?>

</span> </div> </div> </div> </div>
<div class="col-xs-24 messages messages-img" style="width:250px;">
  <?php if(isadmin($_SESSION['steamid'])){
  echo'Admin tools: [<a href="chatadm.php?do=clear" onclick="return     popitup(\'chatadm.php?do=clear\');">clear chat</a>], [<a href="chatadm.php?   do=toggle" onclick="return popitup(\'chatadm.php?do=toggle\');">turn '.    (chaton() ? 'off' : 'on').'</a>]';
   } ?>
<? include ('mini-chat.php'); ?>
</div> </div>
</div>
<div id="raffle"><div class="col-xs-24 raffle"> <div class="cont"> <div class="circle"> <img id="raffle-img"> </div> <h4 class="name" id="raffle-name"></h4> 
<h4 id="countdown-raffle-timer" data-countdown="2020-08-08"></h4> 
<a class="btn btn-default" href="?login">LOG IN</a> </div> </div> </div>      </div> </div>

1 个答案:

答案 0 :(得分:0)

尝试将method =“get”改为method =“post”