使用jquery在下拉菜单中输出所需的值

时间:2015-08-07 13:18:18

标签: jquery drop-down-menu menu

我有一个网站,在手机屏幕上有这个下拉菜单。它使用户可以选择不同类别的服务。当您选择某个类别时,该网站会将您转到右侧页面。

问题是,下拉菜单会返回原始值(全部)。我希望它显示它所在的页面。意思是如果用户选择商业广告,则菜单将显示商业广告,而不是返回全部。

这是下拉菜单的代码:

<select class="news-filters-select" name="news-filters-select" onchange="location = this.options[this.selectedIndex].value;">
  <option value="http://example.com/fr/service/renovation/">All</option>
  <option value="http://example.com/fr/service/renovation/categorie/commercial">Commercial</option>
  <option value="http://example.com/fr/service/renovation/categorie/multilogements">Multilogements</option>
  <option value="http://example.com/fr/service/renovation/categorie/residentiel">Residentiel</option>
</select>

我用jquery尝试过不同的东西,但似乎没什么用。

1 个答案:

答案 0 :(得分:0)

你可以这样做:

Sub Get_Model_File_Names()
    Dim xRow As Long
    Dim xDirect, xFname

    'DIRECTORY TO SELECT FOLDER FROM
    With Application.FileDialog(msoFileDialogFolderPicker)
        .Title = "Please select a folder"
        .Show

        'LOCATES FILES
        If .SelectedItems.Count <> 0 Then
            xDirect = .SelectedItems(1) & "\"
            xFname = Dir(xDirect)

            'LOOPS THROUGH EACH FILE NAME IN FOLDER
            Do While xFname <> ""

                'EXTRACT INFORMATION FROM FILE NAME
                xFname = Left(Dir, 10)
                DrawingNumb = Left(xFname, 7)
                RevNumb = Mid(xFname, 10, 2)

                'INSERT INFO INTO EXCEL
                ActiveCell.Offset(xRow, 0) = DrawingNumb
                ActiveCell.Offset(xRow, 1) = RevNumb
                xRow = xRow + 1
             Loop

        End If
    End With
End Sub