第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

scrollTop,scrollHeight問題???

scrollTop,scrollHeight問題?。?/h1>
_Jason 2015-04-04 23:02:33
代碼 56 ?行: ? ? ? conBox.scrollTop = conBox.scrollHeight; //為什么這句代碼不起作用呢?<!DOCTYPE?html> <html> <head> <meta?charset="UTF-8"> <title>Document</title> <style> div,ul,li,h3,a?{margin:0;?padding:0;?list-style:?none;?display:?block;?} h3?{?font-size:?16px;?font-family:?微軟雅黑;?font-weight:?normal;} body?{?background:?#00b38a?url('http://passport.lagou.com/static/images/bgwall.png')?center?100px?no-repeat;} #container?{?width:?270px;?height:?370px;?background:?#fff;?border:5px?solid?#056A58;?padding:10px;?margin:0?auto;?overflow-y:?scroll;} #message-box?{?} #message-box?li?{?max-width:?300px;?min-height:?35px;?margin-top:?15px;?overflow:?hidden;?padding-bottom:?5px;?} .icon{?width:30px;?height:30px;?} .mesInfo?.content?{?margin:?0?10px;?background:?#DEEDFF;?padding:8px;?max-width:?180px;?box-shadow:?2px?2px?3px?#999;?border-radius:5px;?-webkit-border-radius:5px;?-moz-border-radius:5px;?-ms-border-radius:5px;} .mesInfo?.left?.icon?{?float:?left;?background:url('http://i2.tietuku.com/38ac5a121335c8ce.jpg')?no-repeat?0?0;} .mesInfo?.right?.icon?{?float:?right;?background:url('http://i2.tietuku.com/426b90ba0a60fb01.jpg')?no-repeat?0?0;} .mesInfo?.right?.content?{?float:?right;?} .mesInfo?.left?.content?{?float:?left;} #msgbox?{?width:?300px;?height:105px;?margin:?0?auto;?overflow:?hidden;?position:?relative;?background:?#fff;} #msgbox?.icon1?{?width:30px;?height:30px;?background:url('http://i2.tietuku.com/38ac5a121335c8ce.jpg')?no-repeat?0?0;?} #msgbox?.icon2?{?width:30px;?height:30px;?background:url('http://i2.tietuku.com/426b90ba0a60fb01.jpg')?no-repeat?0?0;?} #msgbox?.icon?{?margin:?5px;?cursor:?pointer;} .icon-box?{?float:?left;} .msgcontent?{?float:?right;?margin:5px;?} .msgcontent?textarea?{?resize:none;?} #reset?{?position:?absolute;?right:?55px;?bottom:?5px;?} #send?{?position:?absolute;?right:?5px;?bottom:?5px;?} #msgbox?.sel?{?width:?29px;?height:?29px;?border:?1px?solid?red;} </style> <script> window.onload?=?function?(){ var?tarea1?=?document.getElementById('tarea'); var?msglist?=?document.getElementById('message-box'); var?newLi?=?document.createElement('li'); var?conBox?=?document.getElementById('container'); var?icon1?=?document.getElementById('icon1'); var?icon2?=?document.getElementById('icon2'); var?oSend?=?document.getElementById('send'); icon1.onclick?=?function?(){ icon1.className?=?"icon1?icon?sel"; icon2.className?=?"icon2?icon"; oSend.onclick?=?function?(){ msglist.innerHTML?+=?"<li?class=\"mesInfo\"><div?class=\"left\"><span?class=\"icon\"></span><h3?class=\"content\">"?+?tarea1.value?+?"</h3></div></li>"; msglist.appendChild(msglist); conBox.scrollTop?=?conBox.scrollHeight;?//為什么這句代碼不起作用呢? }; }; icon2.onclick?=?function?(){ icon2.className?=?"icon2?icon?sel"; icon1.className?=?"icon1?icon"; oSend.onclick?=?function?(){ msglist.innerHTML?+=?"<li?class=\"mesInfo\"><div?class=\"right\"><span?class=\"icon\"></span><h3?class=\"content\">"?+?tarea1.value?+?"</h3></div></li>"; msglist.appendChild(msglist); conBox.scrollTop?=?conBox.scrollHeight;?//為什么這句代碼不起作用呢? }; }; } </script> </head> <body> <div?id="container"> <ul?id="message-box"> <li?class="mesInfo"><div?class="left"><span?class="icon"></span><h3?class="content">我負(fù)責(zé)打打殺殺,你負(fù)責(zé)貌美如花!</h3></div></li> <li?class="mesInfo"><div?class="right"><span?class="icon"></span><h3?class="content">額,好噠!</h3></div></li> </ul> </div> <div?id="msgbox"> <div> <a?class="icon1?icon"?id="icon1"></a> <a?class="icon2?icon"?id="icon2"></a> </div> <div> <form> <textarea?id="tarea"?cols="32"?rows="4"?placeholder="[文明用語]?隨便說點(diǎn)什么吧!"></textarea> <button?id="reset"?type="reset"?value="Reset">重置</button> <button?id="send"?type="button"?value="Submit">發(fā)送</button> </form> </div> </div> </body> </html>
查看完整描述

1 回答

?
靈感l(wèi)s展望

TA貢獻(xiàn)6條經(jīng)驗(yàn) 獲得超0個(gè)贊

這段javascript代碼是不是要實(shí)現(xiàn)發(fā)送后,滾動(dòng)條隨著發(fā)送內(nèi)容多少滾動(dòng),一直顯示最下面的。

如果是的話,把53這行代碼去掉吧,它已經(jīng)報(bào)錯(cuò)了,去掉就可以跟著滾動(dòng)了

查看完整回答
反對 回復(fù) 2015-04-04
  • _Jason
    _Jason
    是的滾動(dòng)條隨內(nèi)容滾動(dòng),我重新貼了代碼,除了msglist.appendChild(msglist); 沒有發(fā)現(xiàn)報(bào)錯(cuò)呀?。。。?/div>
  • 靈感l(wèi)s展望
    靈感l(wèi)s展望
    是這行msglist.appendChild(msglist);把他去掉就可以了,這句沒起什么用,還報(bào)錯(cuò)了。
  • 1 回答
  • 0 關(guān)注
  • 2712 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號