我们可以为网站多级类别的列表框值执行此imacros javascript吗? [英] can we do this imacros javascript for listbox values of website multi level categories
问题描述
我不确定从哪里开始.我有一个网站,数据存储在列表框控件中.如果我使用"TXTALL"标签,则可以保存列表值.
i am not sure where to start. i have a website where data is stored in list box controls. If i use "TXTALL" tag i can save list values.
第一步是收集"_s_brand"制造商列表并将其存储在阵列中 第二步是收集第二级家族-"_ s_name",并为每个"_s_brand"制造商将其存储在arrany中 第三步是为每个"_s_brand"和每个"_s_name"收集系列 第四步是对每个"_s_brand",每个"_s_name"和每个收集"_s_model"值进行最终设置
1st step is to collect list of "_s_brand" manufacturers and store it in a array 2nd step is to collet 2nd level families - "_s_name" and store it in arrany for each "_s_brand" manufacturer 3rd step is to collect series for each "_s_brand" and for each "_s_name" 4th step is to final setp is for each "_s_brand" and for each "_s_name" and for each collect "_s_model" values
启动脚本如下.
var jsLF = "\n";
var macro1;
macro1 = "CODE:";
macro1 += "VERSION BUILD=9002379" + jsLF;
macro1 += "TAB T=1" + jsLF;
macro1 += "TAB CLOSEALLOTHERS" + jsLF;
macro1 += "URL GOTO=http://smartparts.co.uk/" + jsLF;
macro1 += "TAG POS=1 TYPE=SELECT FORM=ACTION:/catalog/?left_selector=1 ATTR=NAME:brand EXTRACT=TXTALL"
var s_brand = new Array()
iimPlay("CODE:TAG POS=1 TYPE=SELECT FORM=ACTION:/catalog/?left_selector=1 ATTR=NAME:brand EXTRACT=TXTALL");
if (iimGetLastExtract()!='#EANF#')
s_brand.push(iimGetLastExtract());
iimDisplay (s_brand);
它将所有数据转储到阵列中.如何在这里分隔元素,以便如果我循环"s_brand",我将获得单个品牌.
it is dumping all data into the array. how to seperate elements here so that if i loop "s_brand" i will get individual brands.
我分开使用它们后,如何进入子类别的下一级
after i seperate how do i use them to go to next level of sub category
推荐答案
为此,您必须使用JS.
For this you have to use JS.
有用的功能.
s_brand=s_brand .toString();
这样,您可以将数组转换为字符串并执行类似的方法
This way you can convert array into string and do methods like
split()
replace()
match()
search()
当您以文本形式查看数组时,可以在_s_brand
上使用split()并获取品牌.
When you look into the array as a text you can use split() on _s_brand
and get brands.
并尝试使用此方法
//convert text into array
some_array=some_array.split("keyword");
//loop through array
for(var i = 0; i < some_array.length ; i++)
{
//do something
alert(some_array[i]);
}
将上述表达式和正则表达式结合使用,可以从文本中提取所需的内容.
Combining the above and regular expressions you can extract what you want form the text.
我希望这会有所帮助.
这篇关于我们可以为网站多级类别的列表框值执行此imacros javascript吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!