abstract:<script> // JS寫的 // var btn = document.getElementsByTagName('button')[0]; // btn.add
<script> // JS寫的 // var btn = document.getElementsByTagName('button')[0]; // btn.addEventListener("click", aa,false); // function aa() { // var a=document.getElementsByTagName("a"); // for (var i=0;i<a.length;i++){ // a[i].style.background='rgb('+Math.floor(Math.random()*256)+','+Math.floor(Math.random()*256)+','+Math.floor(Math.random()*256)+')'; // a[i].innerHTML=Math.floor(Math.random()*100) // } // } // jquery與js綜合 $('button').click(function () { var a=document.getElementsByTagName("a"); for (var i=0;i<a.length;i++){ a[i].style.background='rgb('+Math.floor(Math.random()*256)+','+Math.floor(Math.random()*256)+','+Math.floor(Math.random()*256)+')'; a[i].innerHTML=Math.floor(Math.random()*100) } }); </script>
Correcting teacher:查無此人Correction time:2019-05-20 09:10:48
Teacher's summary:完成的不錯。jq比js簡單很多,多練習,jq可以代替js操作。繼續(xù)加油。