Site Notice

hello, world

Difference between revisions of "超星弹幕助手"

From Project-EPB Commons
([InPageEdit] 没有编辑摘要)
([InPageEdit] 没有编辑摘要)
Line 5: Line 5:
 
<button id="RKLBChat_sendMsg" onclick="sendCommentByMe()">发送评论</button>
 
<button id="RKLBChat_sendMsg" onclick="sendCommentByMe()">发送评论</button>
 
<script>
 
<script>
function sendComment(user, msg) {
+
function sendComment(user, comment) {
   if (msg === '' || user === '') return;
+
   if (comment === '' || user === '') return;
   $('#msgArea').append('<p class="comment">' + user + ':' + msg + '<span style="color:#ccc">'+new Date().toTimeString() + '</span></p>');
+
   $('#msgArea').append('<p class="comment">' + user + ':' + comment + '<span style="color:#999">' + new Date().toTimeString() + '</span></p>');
   $('#msgArea').scrollTop = $('#msgArea').scrollHeight;
+
   var div = document.getElementById('msgArea');
 +
  div.scrollTop = div.scrollHeight;
 
}
 
}
 
function sendCommentByMe(){
 
function sendCommentByMe(){
Line 18: Line 19:
 
   sendComment(其他人','大概是……然后吧……我觉得呢……你们说呢?');
 
   sendComment(其他人','大概是……然后吧……我觉得呢……你们说呢?');
 
},5000);
 
},5000);
 
 
</script>
 
</script>
 
</html>
 
</html>

Revision as of 00:33, 22 February 2020

<html> <script src="https://common.wjghj.cn/js/ChaoXingDanMuZhuShou"></script> <pre id="msgArea" style="padding: 4px; height: 200px; overflow: auto; border: 1px solid #aaa;"><p class="comment">老师:同学们怎么想呢?<span style="color:#ccc"></span> </p></pre> <textarea id="RKLBChat_sendText"></textarea> <button id="RKLBChat_sendMsg" onclick="sendCommentByMe()">发送评论</button> <script> function sendComment(user, comment) {

 if (comment === '' || user === '') return;
 $('#msgArea').append('<p class="comment">' + user + ':' + comment + '<span style="color:#999">' + new Date().toTimeString() + '</span></p>');
 var div = document.getElementById('msgArea');
 div.scrollTop = div.scrollHeight;

} function sendCommentByMe(){

 var toSent = $('#RKLBChat_sendText').val();
 $('#RKLBChat_sendText').val('');
 sendComment('您', toSent);

} setInterval(function(){

 sendComment(其他人','大概是……然后吧……我觉得呢……你们说呢?');

},5000); </script> </html>