<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>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                # 設置一個元素的HTML內容 <div> <h1><span style="font-size: 14px; line-height: 1.5;"></span></h1></div><b style="background-color: rgb(255, 255, 255); font-size: 21px;">問題</b><div><h1><span style="font-size: 14px; line-height: 1.5;"></span></h1> <p>你需要一個元素中的HTML內容</p> <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>中的HTML設置方法具體如下:</p> <pre><code>Element div = doc.select("div").first(); // &lt;div&gt;&lt;/div&gt; div.html("&lt;p&gt;lorem ipsum&lt;/p&gt;"); // &lt;div&gt;&lt;p&gt;lorem ipsum&lt;/p&gt;&lt;/div&gt; div.prepend("&lt;p&gt;First&lt;/p&gt;");//在div前添加html內容 div.append("&lt;p&gt;Last&lt;/p&gt;");//在div之后添加html內容 // 添完后的結果: &lt;div&gt;&lt;p&gt;First&lt;/p&gt;&lt;p&gt;lorem ipsum&lt;/p&gt;&lt;p&gt;Last&lt;/p&gt;&lt;/div&gt; Element span = doc.select("span").first(); // &lt;span&gt;One&lt;/span&gt; span.wrap("&lt;li&gt;&lt;a href='http://example.com/'&gt;&lt;/a&gt;&lt;/li&gt;"); // 添完后的結果: &lt;li&gt;&lt;a href="http://example.com"&gt;&lt;span&gt;One&lt;/span&gt;&lt;/a&gt;&lt;/li&gt; </code></pre> <h2>說明</h2> <ul> <li><code><a title="Set this element's inner HTML." href="http://jsoup.org/apidocs/org/jsoup/nodes/Element.html#html%28java.lang.String%29">Element.html(String html)</a></code> 這個方法將先清除元素中的HTML內容,然后用傳入的HTML代替。</li> <li><code><a title="Add inner HTML into this element." href="http://jsoup.org/apidocs/org/jsoup/nodes/Element.html#prepend%28java.lang.String%29">Element.prepend(String first)</a></code> 和 <code><a title="Add inner HTML to this element." href="http://jsoup.org/apidocs/org/jsoup/nodes/Element.html#append%28java.lang.String%29">Element.append(String last)</a></code> 方法用于在分別在元素內部HTML的前面和后面添加HTML內容</li> <li><code><a title="Wrap the supplied HTML around this element." href="http://jsoup.org/apidocs/org/jsoup/nodes/Element.html#wrap%28java.lang.String%29">Element.wrap(String around)</a></code> 對元素包裹一個外部HTML內容。</li> </ul> <h2>參見</h2> <p>可以查看API參考文檔中 <code><a title="Create a new element by tag name, and add it as the first child." href="http://jsoup.org/apidocs/org/jsoup/nodes/Element.html#prependElement%28java.lang.String%29">Element.prependElement(String tag)</a></code>和<code><a title="Create a new element by tag name, and add it as the last child." href="http://jsoup.org/apidocs/org/jsoup/nodes/Element.html#appendElement%28java.lang.String%29">Element.appendElement(String tag)</a></code> 方法來創建新的元素并作為文檔的子元素插入其中。</p></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>

                              哎呀哎呀视频在线观看