//首先,设置一个变量 let searchResults1 = [];//这就是一个数组 //再写一个按钮函数,来调用搜索数值和保存 functionbcsz() { //这里是如果数组为空就搜索,搜索完了弹窗“搜索完了”如果数组里面有东西,就直接弹窗“搜索完了”用来防止部分人才用户反复搜索 if (searchResults1.length === 0) { h5gg.clearResults(); h5gg.searchNumber('1600', 'I32', '0x00000000', '0x200000000'); h5gg.searchNearby('29281', 'I32', '0x200'); h5gg.searchNumber('1600', 'I32', '0x00000000', '0x200000000'); var count = h5gg.getResultsCount(); var results = h5gg.getResults(count);
searchResults1 = [];
for (var i = 0; i < count; i++) { var addr = results[i].address; searchResults1.push(addr); } //保存数值到数组里面 }alert("搜索完了"); }
纯享版
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
functionbcsz() { if (searchResults1.length === 0) { h5gg.clearResults(); h5gg.searchNumber('1600', 'I32', '0x00000000', '0x200000000'); h5gg.searchNearby('29281', 'I32', '0x200'); h5gg.searchNumber('1600', 'I32', '0x00000000', '0x200000000'); var count = h5gg.getResultsCount(); var results = h5gg.getResults(count);
searchResults1 = [];
for (var i = 0; i < count; i++) { var addr = results[i].address; searchResults1.push(addr); } }alert("搜索完了"); }
然后我们再编辑一个按钮函数,用来获取数值里面的数值,具体办法就不过多赘述啦
1 2 3 4 5 6 7 8 9 10 11 12
functionxg() { if (searchResults1.length === 0) { alert("请先初始化"); return; } for (var i = 0; i < searchResults1.length; i++) { var addr = searchResults1[i];