javascript - for rounding problem
phpcn_u1582
phpcn_u1582 2017-05-19 10:45:55
0
1
403
function integer_methods(){ var aArray=document.getElementById('wang').getElementsByTagName("em"); for(var i = 0;i < aArray.length; i++) { aArray[i].toFixed(0); //提示出错 TypeError: aArray[i].toFixed is not a function } }

I want to round the contents of all em tags under ID wang

phpcn_u1582
phpcn_u1582

reply all (1)
仅有的幸福
Number(aArray[i])

toFixed函数是Number的方法。而aArray[i]的类型是HTMLElement

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!