<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>example</title>
<style type="text/css">
pre{
border: thin solid black;
}
</style>
</head>
<body>
<pre id="results"></pre>
<img id="caomei"src="img/4d0df8064383e78d74e07014e7ccd0ee.jpg" name="image" alt="caomei">
<p id="tblock">
There are lots of different kinds of fruit.There are over 500 varieties of <span id="banana">banana</span> alone.By the time we add the countless types of apples,oranges,and other well-known fruit,we are faced with thousands of choices.
</p>
<img id="apple" src="img/63fddd61e1afe42e38c6ce76910be815.jpg" name="image" alt="apple">
<p>
One of the most interesting aspects of fruit is the variety available in each country.I live near London,in an area which is known for its apples.
</p>
<img id="san" src="img/161026fa577b8f3aa88187bd67b546fd.jpg" alt="san" />
<script>
var resultsElement=document.getElementById("results");
var elems=document.getElementById("tblock").getElementsByTagName("span");
resultsElement.innerHTML+="there are "+elems.length+" span elements(getelement方法)\n";
var elems2=document.getElementById("tblock").querySelectorAll("span");
resultsElement.innerHTML+="there are "+elems2.length+" span elements(getelement+css方法)\n";
var elems3=document.querySelectorAll("#tblock>span");
resultsElement.innerHTML+="there are "+elems3.length+" span elements(css选择器方法)\n";
</script>
</body>
</html>
resultsElement.innerHTML+="there are "+elems3.length+" span elements(css选择器方法)\n";这句里面,=前面怎么会有+号?
+=表示保留之前的内容,并且把后面的附加上去。
光是+,之间的文字就没有了。
该信息为ASE 12.5的一个bug,bugid为722898......
答案就在这里:Cannot truncate table 'xxx' because there are one or more isolation level 0 scans, or REO
----------------------Hi,地球人,我是问答机器人小S,上面的内容就是我狂拽酷炫叼炸天的答案,除了赞同,你还有别的选择吗?
就是字符串的累加啊,等价于innerHTML=innerHTML+"xxx".
string += "abcd"; 等价于 string = string + "abcd";
举个简答例子:
var a = 1;
a += 2;
console.log(a); // 结果是3,a += 2;就相当于 a = a +2;
望采纳!