猿问

3-13编程题,点击“更多”却出不来结果

3-13编程题

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <script src="  type="text/javascript"></script>
        <link href="style.css" rel="stylesheet" type="text/css" />
        <title>挑战题</title>
    </head>
    
    <body>
        <ul>
            <li style="display:none" title="水果">苹果</li>
            <li style="display:none" title="水果">梨</li>
            <li style="display:none" title="水果">猕猴桃</li>
            <li style="display:none" title="水果">桃子</li>
            <li >黄瓜</li>
            <li >番茄</li>
            <li >西瓜</li>
            <li >柚子</li>
            
        </ul>
        <a href="#">更多</a>
        
        <script>
            $(function(){
                $("a").click(function(){
                    if($("a").text()=="更多"){
                        $("a").text("简明");
                        $("li[title='水果']").css("display","list-item");               

         
                    }
                    else{
                        $("a").text("更多");
                        $("li[title='水果']").css("display","none");                    

    
                    }
                });
                
            });
        </script>
    </body>
</html>


JaneShen
浏览 1423回答 2
2回答

echo_kinchao

您的格式没有写对
随时随地看视频慕课网APP
我要回答