標題: for each 用法 [打印本頁] 作者: ssooi 時間: 2021-3-11 09:58 標題: for each 用法
想請教For Each有辦法從第二個開始嗎?
能夠跳過第一個、直接從第二個開始嗎?
謝謝大家
Set itemlist = IE.document.getElementsByClassName("quantumWizMenuPaperselectOption")
For Each Item In itemlist
If Item.getAttribute("data-value") Like "PM" Then
Item.classList.Add ("isSelected")
Item.setAttribute "aria-selected", "true"
Item.setAttribute "tabindex", "0"
Else
Item.classList.Remove ("isSelected")
Item.setAttribute "aria-selected", "false"
Item.setAttribute "tabindex", "-1"
End If
Next
複製代碼
作者: 准提部林 時間: 2021-3-11 14:15
Set itemlist = IE.document.getElementsByClassName("quantumWizMenuPaperselectOption")
For Each Item In itemlist
N=N+1
IF N>1 THEN
If Item.getAttribute("data-value") Like "PM" Then
Item.classList.Add ("isSelected")
Item.setAttribute "aria-selected", "true"
Item.setAttribute "tabindex", "0"
Else
Item.classList.Remove ("isSelected")
Item.setAttribute "aria-selected", "false"
Item.setAttribute "tabindex", "-1"
End If
END IF
Next作者: ssooi 時間: 2021-3-11 14:29