<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> <script src="js/jquery.js"></script> <script> window.onload = function(){ document.getElementById(‘btnok‘).onclick=function(){ //id选择器 //$(‘#div3‘).html(‘aaaaaaa‘); //class选择器 $(‘.div2‘).html(‘aaaaaaaaaaaaaa‘); //多标签选择 $(‘h1,div‘).html(‘aaaaaaaaa‘); } } </script> </head> <body> <input type="button" id="btnok" value="OK" /> <hr> <h1>111111</h1> <hr> <div>222222222</div> <div class="div2">333333333</div> <div id="div3">444444444</div>f </body> </html>
时间: 2024-10-10 07:14:18