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

為了賬號安全,請及時綁定郵箱和手機立即綁定

為什么跳轉的不是我指定頁面?還是原來的屬性值?

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

? ? <head>

? ? ? ? <title>操作元素屬性</title>

? ? ? ? <script src="http://libs.baidu.com/jquery/1.9.0/jquery.js" type="text/javascript"></script>

? ? ? ? <link href="style.css" rel="stylesheet" type="text/css" />

? ? </head>

? ??

? ? <body>

? ? ? ? <h3>attr()方法設置元素屬性</h3>

? ? ? ? <a id="a1">點我就變</a>

? ? ? ? <div>我改變后的地址是:<span id="tip"></span></div>

? ? ? ??

? ? ? ? <script type="text/javascript">

? ? ? ? ? ? $("#a1").attr("href" , "www.baidu.com");

? ? ? ? ? ? var $url = $("#a1").attr("href");

? ? ? ? ? ? $("#tip").html($url);

? ? ? ? </script>

? ? </body>

</html>


正在回答

1 回答

"www.baidu.com"改成"http://www.baidu.com"就行了

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消
jQuery基礎課程
  • 參與學習       154733    人
  • 解答問題       7289    個

加入課程學習,有效提高前端開發速度

進入課程

為什么跳轉的不是我指定頁面?還是原來的屬性值?

我要回答 關注問題
微信客服

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

幫助反饋 APP下載

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

公眾號

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