黑色邊藍色在變黑色在變藍色,反復變化。代碼應該哪里錯了。求大神看看<!DOCTYPE html><html> <head> <meta charset="utf-8"> <title></title> <script type="text/javascript" src="jquery.js"></script> <script> $(document).ready(function(){ $(document.body).click(function(){ $('div').each(function(){ if($this.style.color!='blue'){ $this.style.color=='blue'); } else{ $this.style.color=='black') } }); }); }); </script> </head> <body> <div>北京</div> <div>上海</div> <div>天津</div> </body></html>
想實現(xiàn)點擊網(wǎng)頁,顏色由黑色變藍色,在點擊,在變回黑色。
qq_控心_0
2016-03-13 13:03:41