关于JS,+=连接字符串,为什么一定要前面加str +=才能连接啊?
php实习生
php实习生 2017-02-25 16:04:30
0
2
1104

 var str = "窗口左边距离:"+e.clientX+",窗口顶边距离:"+e.clientY;

                str += "\n网页左边距离:"+e.pageX+",网页顶边距离:"+e.pageY;

                str += "\n屏幕左边距离:"+e.screenX+",屏幕顶边距离:"+e.screenY;

                str += "\n事件类型:"+e.type;

谢谢!

php实习生
php实习生

学习

reply all(2)
数据分析师

Regarding JS, += connection string, why must we add str += in front to connect? -PHP Chinese website Q&A-About JS, += connection string, why must we add str += in front to connect? -PHP Chinese website Q&A

Let’s take a look and learn.

阿神

str +=字符串  等于  str =str+字符串  这两个语句是相等的

上面的意思是把字符串加在str后面,组成一个整体的字符串

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template