var tel=document.getElementById("tel").value;
document.getElementById 的方法大家都很熟悉。但是在使用过程中经常有问题,注意需要在后边加入.value来获取该ID的具体值,进行操作
var total=document.getElementById("total"); alert(total.outerText);
<span id="total">test</span>
注意 span中的访问方式不是Value 而是 outerText