1.获取span的值 var x1=document.getElememtById("id").innerText; var x2=document.getElementById("id").innerHtml;