2017-08-24 78 views
0

由於我是javascript的noobs,我需要一些幫助來弄清楚如何使用純javascript來獲取html代碼的特定部分。使用Javascript獲取部分HTML代碼

我想演這個角色:

6LfLgwgTAAAAAFgpAIOgNmfzKi5Ko2ZnNeIE2uLR

從HTML代碼如下:

<div id="document-container"> 
 
    <div style="width: 304px; height: 78px;"> 
 
    <div> 
 
     <iframe src="https://www.example.com/document/api2/anchor?k=6LfLgwgTAAAAAFgpAIOgNmfzKi5Ko2ZnNeIE2uLR&amp;co=aHR0cHM6Ly93d3cuZ29vZ2xlLmNvbTo0NDM.&amp;hl=en&amp;v=r20170816175713&amp;size=normal&amp;cb=xksmil4x110" title="document widget" scrolling="no" sandbox="allow-forms allow-same-origin allow-scripts allow-top-navigation allow-modals allow-popups allow-popups-to-escape-sandbox" width="304" height="78" frameborder="0"> 
 
     </iframe> 
 
    </div> 
 
    <textarea id="g-document-response" name="g-document-response" class="g-document-response" style="width: 250px; height: 40px; border: 1px solid #c1c1c1; margin: 10px 25px; padding: 0px; resize: none; display: none; "> 
 
    </textarea> 
 
    </div> 
 
</div>

我確實相信可以使用document.getElementByIdregex。我想我可以使用PHP來做到這一點,但我不知道如何在JavaScript中做到這一點。

+0

獲取''