第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

Js動(dòng)態(tài)修改A標(biāo)簽鏈接的問(wèn)題!

Js動(dòng)態(tài)修改A標(biāo)簽鏈接的問(wèn)題!

飲歌長(zhǎng)嘯 2018-12-06 19:36:01
1 <div class="sidebarBox"> 2 <div class="left"> 3 <span></span> 4 </div> 5 <div class="right"> 6 <ul class="map"> 7 <li ><a class="1" href="/Pad/map?floorId=1&catalogId=0" target="map" ><img src="{^}/images/menu_1.jpg" alt="" title="" /></a></li> 8 <li><a class="2" href="/Pad/map?floorId=2&catalogId=0" target="map" ><img src="{^}/images/menu_2.jpg" alt="" title="" /></a></li> 9 <li><a class="3" href="/Pad/map?floorId=3&catalogId=0" target="map" ><img src="{^}/images/menu_3.jpg" alt="" title="" /></a></li> 10 <li><a class="4" href="/Pad/map?floorId=4&catalogId=0" target="map" ><img src="{^}/images/menu_4.jpg" alt="" title="" /></a></li> 11 <li><a class="5" href="/Pad/map?floorId=5&catalogId=0" target="map" ><img src="{^}/images/menu_5.jpg" alt="" title="" /></a></li> 12 </ul> 13 </div> 14 </div> 15 <div class="sidebarBox2" > 16 <div class="left"> 17 <span></span> 18 </div> 19 <div class="title2" id=""> 20 <ul> 21 <li><a name="catalog" href="#" class="733" title="" target="map" ><img src="{^}/images/menu_24.jpg" alt="" title="" /></a></li> 22 <li><a name="catalog" href="#" class="743" title="" target="map" ><img src="{^}/images/menu_27.jpg" alt="" title="" /></a></li> 23 <li><a name="catalog" href="#" class="750" title="" target="map" ><img src="{^}/images/menu_29.jpg" alt="" title="" /></a></li> 24 <li><a name="catalog" href="#" class="759" title="" target="map" ><img src="{^}/images/menu_31.jpg" alt="" title="" /></a></li> 25 <li><a name="catalog" href="#" class="771" title="" target="map" ><img src="{^}/images/menu_34.jpg" alt="" title="" /></a></li> 26 <li><a name="catalog" href="#" class="778" title="" target="map" ><img src="{^}/images/menu_37.jpg" alt="" title="" /></a></li> 27 <li><a name="catalog" href="#" class="803" title="" target="map" ><img src="{^}/images/menu_41.jpg" alt="" title="" /></a></li> 28 29 </ul> 30 </div> 31 32 </div> 這是我的HTML代碼 <script type="text/javascript"> $(function () { $all = $("#shopList"); $(".Normal").toggle(function () { $all.hide().show("slow"); $(".Normal h2").replaceWith("<h2>隱藏</h2>"); }, function () { $all.show().hide("slow"); $(".Normal h2").replaceWith("<h2>顯示</h2>"); }); $(".map li a").click(function(){ var floorId=this.attr("class"); $("a[name='catalog']").each(function(){ this.href="/Pad/map?floorId="+floorId+"&catalogId="+this.attr("class"); }); }); }); </script> 這是我的JS代碼。。 我要實(shí)現(xiàn)點(diǎn)擊class為map的A標(biāo)簽 動(dòng)態(tài)修改name為catalog的A標(biāo)簽 我這JS沒(méi)用 ?請(qǐng)問(wèn)怎么寫才好 ?
查看完整描述

3 回答

?
元芳怎么了

TA貢獻(xiàn)1798條經(jīng)驗(yàn) 獲得超7個(gè)贊

$(".map li a").click(function(){
            var floorId=this.attr("class");
            $("a[name='catalog']").each(function(){
                 this.href="/Pad/map?floorId="+floorId+"&catalogId="+this.attr("class");
            });
        });

這段代碼有問(wèn)題,改為:

$(".map li a").click(function(){
            var floorId=$(this).attr("class");
            $("a[name='catalog']").each(function(){
                 this.href="/Pad/map?floorId="+floorId+"&catalogId="+$(this).attr("class");
            });
        });

注意標(biāo)紅部分。

查看完整回答
反對(duì) 回復(fù) 2018-12-24
?
弒天下

TA貢獻(xiàn)1818條經(jīng)驗(yàn) 獲得超8個(gè)贊

+1樓上 是對(duì)的。 ?this ?是JS 對(duì)象 $(this) 是JQ對(duì)象?

JS沒(méi)有 attr 方法

attr方法 是JQ對(duì)象的

查看完整回答
反對(duì) 回復(fù) 2018-12-24
?
當(dāng)年話下

TA貢獻(xiàn)1890條經(jīng)驗(yàn) 獲得超9個(gè)贊

+1樓上 是對(duì)的。? this? 是JS 對(duì)象 $(this) 是JQ對(duì)象

JS沒(méi)有 attr 方法

attr方法 是JQ對(duì)象的

查看完整回答
反對(duì) 回復(fù) 2018-12-24
  • 3 回答
  • 0 關(guān)注
  • 718 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)