abstrak:<!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() { // //改變單個css屬性 // // $(選擇器).css('屬性名','屬性值') // $('body').css('backgroundColor', '#ccc') // //改變多個CSS屬性 // // $('選擇器').css({'屬性名1':'屬性值1','屬性名2':'屬性值2','屬性名3':'屬性值3'}) // $('p').css({ // 'color': 'red', // 'font-size': '40px', // 'font-weight': 'bold' // }) // //獲取單個CSS的屬性值 // // $('選擇器').css('屬性名') // // alert($('div').css('background')) // alert($('div').css('width')) // // }) //事件 //語法: // $(document).ready(function(){ // }) //*不能與<body onload="">一起使用 //blur()當元素失去焦點==onblur // focus()當元素獲得焦點 // change()當元素的值發(fā)生改變的時候 // click()點擊事件 //dblclick()雙擊事件 // mouseover() 當鼠標指針位于元素上方時會發(fā)生mouseover事件 // mouseenter() 當鼠標指針穿過元素時會發(fā)生mouseenter事件 // mousemove() 當鼠標指針在指定的元素中移動時, 就會發(fā)生該事件 // mouseleave() 當鼠標指針離開元素時 // mouseout() 當鼠標指針從元素上移開時 // mousedown() 當鼠標指針移動到元素上方并按下鼠標按鍵時 // mouseup() 當在元素上松開鼠標按鍵時 // resize() 當調(diào)整當前瀏覽器窗口大小時 // pageX() 屬性是鼠標指針的位置, 相對于文檔的左邊緣 event.pageX event: 必需 參數(shù)來自事件綁定函數(shù)。 // pageY() 屬性是鼠標指針的位置, 相對于文檔的上邊緣 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>點擊</button> --> <!-- <div> 當前鼠標的位置:<span> </span> </div> <div> 頁面被調(diào)整大小的次數(shù):<b> </b> </div> --> <!-- 事件切換 --> <script type="text/javascript"> // hover(over,out) // over:鼠標移上元素上要觸發(fā)的一個函數(shù) // out:鼠標移出元素上要觸發(fā)的一個函數(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>點擊</button> </body> </html>
Guru membetulkan:西門大官人Masa pembetulan:2019-04-22 10:57:41
Rumusan guru:作業(yè)名稱不規(guī)范,代碼不要拷貝課件源碼
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"&