如何选择正文标签而不是ID?

时间:2019-06-10 15:16:05

标签: javascript html css css-selectors

我正在通过javascript和CSS使用媒体查询,

function mwcheckMQ() {
//check if mobile or desktop device
return window.getComputedStyle(document.querySelector('#stay-content'), '::before').getPropertyValue('content').replace(/'/g, "").replace(/"/g, "");}

#stay-content:before {
    content = "tablet";
}

我想将#stay-content更改为body标签。 如何更改此代码?

1 个答案:

答案 0 :(得分:1)

Option Explicit
Sub CopyFiles()
' (1) requires a reference to the object library "Microsoft Scripting Runtime" under Options > Tools > References in the VBE.

    Dim FSO As Scripting.FileSystemObject
    Dim DesPath As String
    Dim C As Range
    Dim LastRow As Long
    Set FSO = New Scripting.FileSystemObject

    DesPath = "C:\Test\" 'your destination path
    With ThisWorkbook.Sheets("MySheet") 'change MySheet for your sheet name
        LastRow = .Cells(.Rows.Count, "BD").End(xlUp).Row 'last row on column BD
        For Each C In .Range("BD2:BD" & LastRow) 'loop through all the cells from 2 to LastRow
            If Not C = vbNullString Then 'check that the cell isn't blank
                FSO.CopyFile C.Value, DesPath, True 'True means overwrite
            End If
        Next C
    End With

End Sub

这两个都可以使用。