亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

求告知第二個代碼的弊端在哪。http://www.xianlaiwan.cn/code/1103#view-editor-tabs-HTML

求告知第二個代碼的弊端在哪。http://www.xianlaiwan.cn/code/1103#view-editor-tabs-HTML

Yuuyu 2016-07-16 21:09:04
為什么“夫唯不爭”這位朋友的代碼多點擊幾次“更多”“簡化”就提示出錯了呢~點贊數最多的這個沒有顯示出錯。①<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><script src="http://libs.baidu.com/jquery/1.9.0/jquery.js" type="text/javascript"></script><title>挑戰題</title></head><body>? ? <ul>? ? ? ? <li>001</li>? ? ? ? <li>002</li>? ? ? ? <li>003</li>? ? ? ? <li>004</li>? ? ? ? <li>005</li>? ? ? ? <li>006</li>? ? ? ? <li>007</li>? ? </ul>? ? <a ?href="javascript:;">更多</a>? ? <script>? ? ? ? $(function(){? ? ? ? ? ? $("li:eq(5)").css("display","none");? ? ? ? ? ? $("li:eq(6)").css("display","none");? ? ? ? ? ? $("a").click(function(){? ? ? ? ? ? ? ? if($("a").text() === "更多"){? ? ? ? ? ? ? ? ? ? $("a").text("簡化");? ? ? ? ? ? ? ? ? ? $("li:eq(5)").css("display","list-item");? ? ? ? ? ? ? ? ? ? $("li:eq(6)").css("display","list-item");? ? ? ? ? ? ? ? }else{? ? ? ? ? ? ? ? ? ? $("a").text("更多");? ? ? ? ? ? ? ? ? ? $("li:eq(5)").css("display","none");? ? ? ? ? ? ? ? ? ? $("li:eq(6)").css("display","none"); ? ? ? ? ??? ? ? ? ? ? ? ? ? ??? ? ? ? ? ? ? ? }? ? ? ? ? ? });? ? ? ? })? ? </script></body></html>②<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>挑戰題</title><style>? ? .no{display:none;}</style></head><body>? ? <ul>? ? ? ? <li>11</li>? ? ? ? <li>22</li>? ? ? ? <li>33</li>? ? ? ? <li>44</li>? ? ? ? <li class="no">55</li>? ? ? ? <li class="no">66</li>? ? ? ? <li>77</li>? ? </ul>? ? <a href="#" id="aaa">更多</a>? ? <script src="http://libs.baidu.com/jquery/1.9.0/jquery.js" type="text/javascript"></script>? ? <script>? ? ? ? $(function(){? ? ? ? ? ? $("#aaa").click(function(){? ? ? ? ? ? ? ? var text = $("#aaa").text();? ? ? ? ? ? ? ? if(text == "更多"){? ? ? ? ? ? ? ? ? ? $("#aaa").html("簡化");? ? ? ? ? ? ? ? ? ? $("li[class=no]").show();? ? ? ? ? ? ? ? }else{? ? ? ? ? ? ? ? ? ? $("#aaa").html("更多");? ? ? ? ? ? ? ? ? ? $("li[class=no]").hide();? ? ? ? ? ? ? ? }? ? ? ? ? ? });? ? ? ? });? ? </script></body></html>
查看完整描述

1 回答

?
stone310

TA貢獻361條經驗 獲得超191個贊

出錯代碼發來看下,我試了好多次都沒出錯

查看完整回答
反對 回復 2016-08-13
  • 1 回答
  • 0 關注
  • 1238 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號