请教求助帮忙,感谢
javascript吧
全部回复
仅看楼主
level 1
lcde01 楼主
<textarea id="aa">1,2,3,4,5,6,7,8,9,0,</textarea>
<textarea id="bb">0,9,8,7,6,5,4,3,2,1,</textarea>
<p id="showConut"></p>
<script>
var showConut = document.getElementById("showConut");
function aa(){
var selection = window.getSelection().toString();
var n=(selection.split(',')).length-1;
if (n == 0){ showConut.innerText = null; }
else{ showConut.innerText = n; }
};
document.addEventListener("selectionchange", aa);
</script>
怎么只在id=aa 下选取统计结果呢?
2022年10月29日 07点10分 1
level 3
我新建了个前端萌新互助群!都是萌新阶层大家都开始学!没有卖课!没有广告!
群号:235419843
大家一起来学习呀!
2022年11月04日 02点11分 2
1