为了账号安全,请及时绑定邮箱和手机立即绑定

在这里问一个额外的问题,这是一个仿弹幕向左滑动的网页,请大佬帮我看看为什么输出是object Object

https://img1.sycdn.imooc.com//5d5e4d8d0001b4b206430574.png

https://img1.sycdn.imooc.com//5d5e4d8d0001003505070210.png

https://img1.sycdn.imooc.com//5d5e4d8d00016b4f05730311.png

单独输出文字

$jieshou.append("<p>"+$content+"</p>");

是可以正常发送的,但是加了图片后也就是加了$img后就显示为object Object+"发送的内容",真的搞不懂了,单独输入$img 也是可以的 请大佬帮我看一下究竟是什么问题

正在回答

2 回答

https://m.vk.com/album712782483_285971686
https://m.vk.com/album712781332_283441849
https://m.vk.com/album712772904_281939585
https://m.vk.com/album712774205_283345814
https://m.vk.com/album712534118_283396727
https://m.vk.com/album712782889_283694745
https://m.vk.com/album712781708_283396748
https://m.vk.com/album712782082_283441926
https://m.vk.com/album712782483_285971788
https://m.vk.com/album712781332_283441946
https://m.vk.com/album712772904_281939713
https://m.vk.com/topic-210967729_48611617
https://m.vk.com/topic-210967729_48611620
https://m.vk.com/topic-210967729_48611621
https://m.vk.com/topic-210967729_48611624
https://m.vk.com/topic-210967729_48611626
https://m.vk.com/topic-210967729_48611627
https://m.vk.com/topic-210967729_48611629
https://m.vk.com/topic-210967729_48611630
https://m.vk.com/topic-210967729_48611632
https://m.vk.com/topic-210967729_48611634
https://m.vk.com/topic-210967729_48611638
https://m.vk.com/topic-210967729_48611639
https://m.vk.com/topic-210967729_48611642
https://m.vk.com/topic-210967729_48611643
https://m.vk.com/topic-210967729_48611644
https://m.vk.com/topic-210967729_48611645
https://m.vk.com/topic-210967729_48611648
https://m.vk.com/topic-210967729_48611650
https://m.vk.com/topic-210967729_48611651
https://m.vk.com/topic-210967729_48611653
https://m.vk.com/topic-210967729_48611655
https://m.vk.com/topic-210967729_48611657
https://m.vk.com/topic-210967729_48611658
https://m.vk.com/topic-210967729_48611659
https://m.vk.com/topic-210967729_48611663
https://m.vk.com/topic-210967729_48611664
https://m.vk.com/topic-210967729_48611668
https://m.vk.com/topic-210967729_48611669
https://m.vk.com/topic-210967729_48611670
https://m.vk.com/topic-210967729_48611671
https://m.vk.com/topic-210967729_48611673
https://m.vk.com/topic-210967729_48611677
https://m.vk.com/topic-210967729_48611679
https://m.vk.com/topic-210967729_48611682
https://m.vk.com/topic-210967729_48611686
https://m.vk.com/topic-210967729_48611689
https://m.vk.com/topic-210967729_48611691
https://m.vk.com/topic-210967729_48611693
https://m.vk.com/topic-210967729_48611695
https://m.vk.com/topic-210967729_48611698
https://m.vk.com/topic-210967729_48611699
https://m.vk.com/topic-210967729_48611702
https://m.vk.com/topic-210967729_48611705
https://m.vk.com/topic-210967729_48611707
https://m.vk.com/topic-210967729_48611709
https://m.vk.com/topic-210967729_48611711
https://m.vk.com/topic-210967729_48611712
https://m.vk.com/topic-210967729_48611714
https://m.vk.com/topic-210967729_48611717
https://m.vk.com/topic-210967729_48611720
https://m.vk.com/topic-210967729_48611721
https://m.vk.com/topic-210967729_48611725
https://m.vk.com/topic-210967729_48611727
https://m.vk.com/topic-210967729_48611729
https://m.vk.com/topic-210967729_48611731
https://m.vk.com/topic-210967729_48611732
https://m.vk.com/topic-210967729_48611734
https://m.vk.com/topic-210967729_48611736
https://m.vk.com/topic-210967729_48611737
https://m.vk.com/topic-210967729_48611743
https://m.vk.com/topic-210967729_48611746
https://m.vk.com/topic-210967729_48611748
https://m.vk.com/topic-210967729_48611750
https://m.vk.com/topic-210967729_48611752
https://m.vk.com/topic-210967729_48611754
https://m.vk.com/topic-210967729_48611758
https://m.vk.com/topic-210967729_48611762
https://m.vk.com/topic-210967729_48611764
https://m.vk.com/topic-210967729_48611766
https://m.vk.com/topic-210967729_48611769
https://m.vk.com/topic-210967729_48611770
https://m.vk.com/topic-210967729_48611773
https://m.vk.com/topic-210967729_48611776
https://m.vk.com/topic-210967729_48611781
https://m.vk.com/topic-210967729_48611784
https://m.vk.com/topic-210967729_48611787
https://m.vk.com/topic-210967729_48611788
https://m.vk.com/topic-210967729_48611792
https://m.vk.com/topic-210967729_48611797
https://m.vk.com/topic-210967729_48611799
https://m.vk.com/topic-210967729_48611802
https://m.vk.com/topic-210967729_48611831
https://m.vk.com/topic-210967729_48611832
https://m.vk.com/topic-210967729_48611835
https://m.vk.com/topic-210967729_48611838
https://m.vk.com/topic-210967729_48611843
https://m.vk.com/topic-210967729_48611849
https://m.vk.com/topic-210967729_48611853
https://m.vk.com/topic-210967729_48611856


0 回复 有任何疑惑可以回复我~

$img是个JQery对象.

当它和字符串进行+操作时,相当于调用了toString().

而$content也是JQuery对象,它和字符串进行+操作后也变成了String.但是$content本身是String对象.所以这里看不出来变化.

$jieshou.append($img + "<P>" + $content + "</p>");

改写成

$jieshou.append($img, "<P>" + $content + "</p>");

这样就没问题了.

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

在这里问一个额外的问题,这是一个仿弹幕向左滑动的网页,请大佬帮我看看为什么输出是object Object

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信