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

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定

appedn可以同時(shí)插入圖片和文字嗎

var?$content?=?$("#dc").val();//變量1?文本
var?$jieshou?=?$("#main");//被插入的地方
$jieshou.append("<img?src='icon/1.png'>"?,?"<p>"+":"+$content+"</p>");//表達(dá)式

問題來了,單獨(dú)插入圖片或者文本都可以實(shí)現(xiàn),但是兩者相加后就只能輸入文字,不能同時(shí)輸出文本加圖片。有大佬解釋一下為什么嗎?

還是不能用append方法,

完整代碼

<!DOCTYPE?html>
<html>
<head>
????<meta?charset="UTF-8">
????<title>Title</title>
????<link?rel="stylesheet"?href="css/danmu.css">

????<script?src="js/jquery-1.9.1.min.js"></script>
????<script?src="js/animate.min.js"></script>

</head>
<body>
<script>
????$(document).ready(function?()?{
????????$("#send1").click(function?()?{
????????????var?pageH=parseInt($("#main").height());
????????????var?$content?=?$("#dc").val();
????????????var?$jieshou?=?$("#main");
???????????//?var?$img?=?$("#img2").html("<img?src='icon/2.png'>");
???????????//?$img.css({"width":"30px","height":"30px",});
????????????var?_top=parseInt(Math.random()*pageH);
????????????$jieshou.append("<img?src='icon/1.png'>"?,?"<p>"+":"+$content+"</p>");
????????????$("p:last-child").css({"top":_top,"color":"white",});
????????????$("p:last-child").animate({"left":"-200px"},8000);
????????????$("img:last-child").css({"width":"30px","height":"30px","top":_top});
????????????$("img:last-child").animate({"left":"-200px"},8000);

????????})
????????
????})
</script>

<div?id="content">
????<div?id="main">
????????<p></p>
????</div>
????<div?id="send">????????
????????<div?id="co">
????????????<button?id="open">開啟彈幕</button>
????????????<button?id="close">關(guān)閉彈幕</button>
????????</div>
????????<div?id="danmu">
????????????<input?type="text"?placeholder="發(fā)個(gè)友好的彈幕"?id="dc">
????????</div>
????????<div?id="finish">
????????????<button?id="send1">發(fā)送</button>
????????</div>
????</div>
????
</div>
</body>
</html>

實(shí)現(xiàn)一個(gè)彈幕圖片+文字的效果

正在回答

1 回答

可以?

$jieshou.append("<img?src='icon/1.png'>"?,?"<p>"+":"+$content+"</p>");
$jieshou.append("<img?src='icon/1.png'><p>"+":"+$content+"</p>");
直接連著寫就行??親測可以

https://img1.sycdn.imooc.com//5d68c3db00015c9c11360875.jpg

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

appedn可以同時(shí)插入圖片和文字嗎

我要回答 關(guān)注問題
微信客服

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

幫助反饋 APP下載

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

公眾號

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