我有一個只包含文本組件的div,一些文本已用背景顏色rgb(255,255,0)高亮顯示。如何使用javascript檢索html中所有突出顯示的單詞
我想要做的是在這個div中獲取顏色rgb(255,255,0)突出顯示的任何內容,並將它們轉換爲使用javascript的字符串數組。
這裏的html代碼:
<html><head>
</head>
<body class="body">
<div style="height: 10px;"></div>
2009 BMW for $5,800.00
<br>
Manheim Auto-Assign on run 3
<br><span style="background-color: rgb(255, 255, 0);">
Condition</span> and <span style="background-color: rgb(255, 255, 0);">Documentation</span> issues
<div style="height: 10px;"></div>
Estimated Gross Profit of $15.00
<br>
Estimated Margin Variance of -42%
<br>
<br>
Offer of $5,775.00
<br>
Current Offer Variance of $825.00
</body></html>
現在,從這個網站,我要檢索的文本Condition
和Documentation
因爲它們是突出的話,並把它們存儲陣列英寸 任何人都可以幫助如何在javascipt中做到這一點?
可以幫助我們通過PO幫助你蜇你的代碼到目前爲止,並解釋什麼不工作? – elclanrs
你可以提供文字嗎? –
可能是他想讓我們寫一個JS代碼 – HackerKarma