在给定的String中搜索某个参数

时间:2015-10-20 23:37:14

标签: javascript html full-text-search jsoup

我有一个重要的大脑放屁。我有一个将项目添加到购物车的java应用程序,我使用JSOUP来解析html文档,因为它无法运行任何javascript脚本。所以我从getElementsByTag()中提取了这个.html();功能。现在我需要找到值1038,但是记住值并不总是1038.所以我需要它来搜索属性 - > 92 - >选项 - > id = 1038。

var spConfig = new Product.Config({
"attributes": {
    "92": {
        "id": "92",
        "code": "color",
        "label": "Color",
        "options": [{
            "id": "1038",
            "label": "GREEN",
            "price": "0",
            "oldPrice": "0",
            "products": ["94035", "94036", "94037", "94038", "94039", "94040", "94041", "94042", "94043", "94044"]
        }]
    },
    "196": {
        "id": "196",
        "code": "size",
        "label": "Size",
        "options": [{
            "id": "189",
            "label": "8    ",
            "price": "0",
            "oldPrice": "0",
            "products": ["94041"]
        }, {
            "id": "188",
            "label": "8.5",
            "price": "0",
            "oldPrice": "0",
            "products": ["94042"]
        }, {
            "id": "187",
            "label": "9",
            "price": "0",
            "oldPrice": "0",
            "products": ["94043"]
        }, {
            "id": "186",
            "label": "9.5",
            "price": "0",
            "oldPrice": "0",
            "products": ["94044"]
        }, {
            "id": "185",
            "label": "10",
            "price": "0",
            "oldPrice": "0",
            "products": ["94035"]
        }, {
            "id": "184",
            "label": "10.5",
            "price": "0",
            "oldPrice": "0",
            "products": ["94036"]
        }, {
            "id": "183",
            "label": "11",
            "price": "0",
            "oldPrice": "0",
            "products": ["94037"]
        }, {
            "id": "182",
            "label": "11.5",
            "price": "0",
            "oldPrice": "0",
            "products": ["94038"]
        }, {
            "id": "181",
            "label": "12",
            "price": "0",
            "oldPrice": "0",
            "products": ["94039"]
        }, {
            "id": "179",
            "label": "13",
            "price": "0",
            "oldPrice": "0",
            "products": ["94040"]
        }]
    }
},
"template": "$#{price}",
"basePrice": "129.98",
"oldPrice": "180",
"productId": "94013",
"chooseText": "Choose an Option...",
"taxConfig": {
    "includeTax": false,
    "showIncludeTax": false,
    "showBothPrices": false,
    "defaultTax": 0,
    "currentTax": 0,
    "inclTaxTitle": "Incl. Tax"
}

});

我需要接收值" 1038",但它不能只是整数1038的搜索函数,因为该值可能会在我的脚本中发生变化。

0 个答案:

没有答案