gpt4 book ai didi

javascript - JavaScript 中的行返回

转载 作者:行者123 更新时间:2023-11-28 21:17:27 24 4
gpt4 key购买 nike

我试图让这个框保持150px的宽度,但是我如何获取比返回文本到下一行而不是展开div更长的检索文本。

       <div id="page" style="position:absolute; float:right; top:500px; right:0px; background-color:#F5F5F5; color: #F6221D; font-size:12px; width:150;">
<h2>ShoutOut</h2>

<form method="post" action="shout.php">
<strong>Message:</strong>
<input type="text" id="message" name="message" class="message" /><input type="submit" id="submit" value="Submit" />
</form>

<div id="shout" style="padding:0 10px 0; width:150; height:170px;; overflow-y:auto;">

</div>
</div>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
$(function() {

//populating shoutbox the first time
refresh_shoutbox();
// recurring refresh every 15 seconds
setInterval("refresh_shoutbox()", 15000);

$("#submit").click(function() {
// getting the values that user typed
var name = $("#name").val();
var message = $("#message").val();
// forming the queryString
var data = 'name='+ name +'&message='+ message;

// ajax call
$.ajax({
type: "POST",
url: "shout.php",
data: data,
success: function(html){ // this happen after we get result
$("#shout").slideToggle(500, function(){
$(this).html(html).slideToggle(500);
$("#message").val("");
});
}
});
return false;
});
});

function refresh_shoutbox() {
var data = 'refresh=1';

$.ajax({
type: "POST",
url: "shout.php",
data: data,
success: function(html){ // this happen after we get result
$("#shout").html(html);
}
});
}

最佳答案

您的 CSS 中有错误:

width:150;

应该是:

width:150px;

关于javascript - JavaScript 中的行返回,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7235394/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com