<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> <title>首页</title> <link rel="stylesheet" type="text/css" href="css/index.css"> <script src="js/jquery-2.1.0.js"></script></head><body> <ul> <li>数据1</li> <li>数据2</li> <li>数据3</li> <li>数据4</li> <li>数据5</li> </ul> <p>ss</p> <script> var lis = $(‘ul li‘); var shuzu = []; var zhi = $(‘ul li‘).html(); console.log(zhi); for(var i= 0;i<lis.length;i++){ shuzu.push($(‘ul li‘).eq(i).height()) } console.log(shuzu) </script> <script type="text/javascript" src="js/index.js"></script></body></html>
时间: 2024-10-20 12:40:06