const para = document.querySelector('p');
para.onclick = function() {
alert('噢,噢,噢,别点我了。');
}
请不要使用 <font>
、 <center>
等表象元素。
在上述的 JavaScript 示例中,para 表示一个段落元素。
按 Ctrl/Cmd + A 选择全部内容。
$ ping mozilla.org PING mozilla.org (63.245.215.20): 56 data bytes 64 bytes from 63.245.215.20: icmp_seq=0 ttl=40 time=158.233 ms