摘要:<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0&q
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title></title> <script type="text/javascript" src="http://ipnx.cn/static/js/jquery.min.js"></script> </head> <body> <script> // $(document).ready(function() { // //改變單個(gè)css屬性 // // $(選擇器).css('屬性名','屬性值') // $('body').css('backgroundColor', '#ccc') // //改變多個(gè)CSS屬性 // // $('選擇器').css({'屬性名1':'屬性值1','屬性名2':'屬性值2','屬性名3':'屬性值3'}) // $('p').css({ // 'color': 'red', // 'font-size': '40px', // 'font-weight': 'bold' // }) // //獲取單個(gè)CSS的屬性值 // // $('選擇器').css('屬性名') // // alert($('div').css('background')) // alert($('div').css('width')) // // }) //事件 //語法: // $(document).ready(function(){ // }) //*不能與<body onload="">一起使用 //blur()當(dāng)元素失去焦點(diǎn)==onblur // focus()當(dāng)元素獲得焦點(diǎn) // change()當(dāng)元素的值發(fā)生改變的時(shí)候 // click()點(diǎn)擊事件 //dblclick()雙擊事件 // mouseover() 當(dāng)鼠標(biāo)指針位于元素上方時(shí)會(huì)發(fā)生mouseover事件 // mouseenter() 當(dāng)鼠標(biāo)指針穿過元素時(shí)會(huì)發(fā)生mouseenter事件 // mousemove() 當(dāng)鼠標(biāo)指針在指定的元素中移動(dòng)時(shí), 就會(huì)發(fā)生該事件 // mouseleave() 當(dāng)鼠標(biāo)指針離開元素時(shí) // mouseout() 當(dāng)鼠標(biāo)指針從元素上移開時(shí) // mousedown() 當(dāng)鼠標(biāo)指針移動(dòng)到元素上方并按下鼠標(biāo)按鍵時(shí) // mouseup() 當(dāng)在元素上松開鼠標(biāo)按鍵時(shí) // resize() 當(dāng)調(diào)整當(dāng)前瀏覽器窗口大小時(shí) // pageX() 屬性是鼠標(biāo)指針的位置, 相對(duì)于文檔的左邊緣 event.pageX event: 必需 參數(shù)來自事件綁定函數(shù)。 // pageY() 屬性是鼠標(biāo)指針的位置, 相對(duì)于文檔的上邊緣 event.pageY event: 必需 參數(shù)來自事件綁定函數(shù)。 // $(document).ready(function() { // // $('input').blur(function(){ // // $('input').css('background','red') // // }) // // $('input').focus(function(){ // // $('input').css('background','blue') // // }) // // $('input').change(function(){ // // $('input').css('background','pink') // // // }) // // $('button').click(function(){ // // $('div').css('background','blue') // // }) // $('div').dblclick(function() { // $(this).css('background', 'pink') // // }) // // $(document).mousemove(function(aa){ // // $('span').text('x: '+aa.pageX+'y: '+aa.pageY) // // }) // a = 0 // $(window).resize(function() { // // alert('窗口被調(diào)整大小') // $('b').text(a++) // }) // // }) </script> <!-- <input type="text" name=""> <div style="width: 100px;height: 100px;background: red;margin-top: 20px;"></div> <button>點(diǎn)擊</button> --> <!-- <div> 當(dāng)前鼠標(biāo)的位置:<span> </span> </div> <div> 頁面被調(diào)整大小的次數(shù):<b> </b> </div> --> <!-- 事件切換 --> <script type="text/javascript"> // hover(over,out) // over:鼠標(biāo)移上元素上要觸發(fā)的一個(gè)函數(shù) // out:鼠標(biāo)移出元素上要觸發(fā)的一個(gè)函數(shù) $(document).ready(function() { // $('div').hover( // function(){ // $(this).css('background','red') // }, // function(){ // $(this).css('color','#fff') // } // ) // toggle() 如果元素是可見的,就切換為隱藏,否則相反 $('button').click(function() { $('p').toggle().css('background', 'red') }) }) </script> <div>我是內(nèi)容</div> <p style="display: none;"></p> <button>點(diǎn)擊</button> </body> </html>
批改老師:西門大官人批改時(shí)間:2019-04-22 10:57:41
老師總結(jié):作業(yè)名稱不規(guī)范,代碼不要拷貝課件源碼
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"&