<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # 設置屬性的值 <div><h2>問題</h2> <p>在你解析一個Document之后可能想修改其中的某些屬性值,然后再保存到磁盤或都輸出到前臺頁面。</p> <h2>方法</h2> <p>可以使用屬性設置方法 <code><a title="Set an attribute value on this element." href="http://jsoup.org/apidocs/org/jsoup/nodes/Element.html#attr%28java.lang.String,%20java.lang.String%29">Element.attr(String key, String value)</a></code>, 和 <code><a title="Set an attribute on all matched elements." href="http://jsoup.org/apidocs/org/jsoup/select/Elements.html#attr%28java.lang.String,%20java.lang.String%29">Elements.attr(String key, String value)</a></code>.</p> <p>假如你需要修改一個元素的 <code>class</code> 屬性,可以使用 <code><a title="Add a class name to this element's class attribute." href="http://jsoup.org/apidocs/org/jsoup/nodes/Element.html#addClass%28java.lang.String%29">Element.addClass(String className)</a></code> 和 <code><a title="Remove a class name from this element's class attribute." href="http://jsoup.org/apidocs/org/jsoup/nodes/Element.html#removeClass%28java.lang.String%29">Element.removeClass(String className)</a></code> 方法。</p> <p><code><a title="A list of Elements, with methods that act on every element in the list." href="http://jsoup.org/apidocs/org/jsoup/select/Elements.html">Elements</a></code> 提供了批量操作元素屬性和class的方法,比如:要為div中的每一個a元素都添加一個 <code>rel="nofollow"</code> 可以使用如下方法:</p> <pre><code>doc.select("div.comments a").attr("rel", "nofollow"); </code></pre> <h2>說明</h2> <p>與<code><a title="A HTML element consists of a tag name, attributes, and child nodes (including text nodes and other elements)." href="http://jsoup.org/apidocs/org/jsoup/nodes/Element.html">Element</a></code>中的其它方法一樣,<code>attr</code> 方法也是返回當 <code><a title="A HTML element consists of a tag name, attributes, and child nodes (including text nodes and other elements)." href="http://jsoup.org/apidocs/org/jsoup/nodes/Element.html">Element</a></code> (或在使用選擇器是返回 <code><a title="A list of Elements, with methods that act on every element in the list." href="http://jsoup.org/apidocs/org/jsoup/select/Elements.html">Elements</a></code> 集合)。這樣能夠很方便使用方法連用的書寫方式。比如:</p> <pre><code>doc.select("div.masthead").attr("title", "jsoup").addClass("round-box"); </code></pre><br></div>
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看