A kind of method of webpage front end locator data
Technical field
The present invention relates to a kind of data enquire method, especially a kind of method of webpage front end locator data.
Background technology
Along with the development of internet technique, the popularity of network is more and more higher, and the website has also obtained significant progress as the main contents supplier of internet.The website no longer is satisfied with content that unified standard only is provided but is wished can be more and user interaction and then can realize providing content service by user's demand.
A lot of websites provide the data, services of data form class for the user, and number of site also can provide some simple query functions for the Interactive Experience that strengthens the user on this basis.Because the visit capacity of website is larger; these simple queries functions for domestic consumer realize for the script that the bulk velocity that does not affect the website generally all adopts front end to explain; simultaneously in order to reduce the expense of database; this class simple queries function generally all leaves in possible Query Result in the array in advance; simultaneously querying condition also is put in the array with existing, carries out the array orientation problem so these query functions can be converted into usually by the script of browser-interpreted.Customary way is the relation of inclusion that checks by circulating between array, but may occur in the situation of or many condition queries many at array element because systemic circulation causes the front end torpor or cause front reaction slow because circulation is nested, and then affect browsing of user.
Summary of the invention
For the problems referred to above that existing webpage front-end array data locator meams exists, the invention provides a kind of be intended to reduce because carrying out cycling produce the slowly method of webpage front end locator data of front reaction.
The technical scheme that technical solution problem of the present invention adopts is:
A kind of method of webpage front end locator data comprises the first array, with the first array the second array and the target array of identical element is arranged, and wherein, specifically comprises the steps;
Step a, with pointed first element separately of described the first array and described the second array indication array interior element;
Step b, described target array interior element is in turn connected into target strings in order, and with described target strings changed string form;
Step c, be instructed in according to described pointer and obtain the first key word in the first array and in the second array, obtain simultaneously the second key word;
Steps d, described the first key word and described the second key word are connected into keyword string, and with described keyword string changed string form;
Step e, utilize regular expression to check whether described keyword string is present in the described target strings, and with predetermined policy record check result;
The pointed of the pointer of step f, described the first array and described the second array is the next element of order of place array separately;
Whether the array element of the pointed of step g, described the first array of inspection exists, and withdraws from as not existing then, then returns step c continuation execution as existing.
The method of above-mentioned webpage front end locator data, wherein, predetermined policy described in the described step e does not then return vacation for keyword string as described is not present in the described target strings, as described keyword string exist with described target strings in then resolve part that described target strings reduction comprises described keyword string in the position of described target array interior element, return element corresponding to this position and return true.
The method of above-mentioned webpage front end locator data, wherein, described step a extremely described step g carries out by the script that is embedded in the hypertext document.
The method of above-mentioned webpage front end locator data, wherein, described predetermined policy is carried out by the script that is embedded in the hypertext document.
The invention has the beneficial effects as follows:
Check character string by the cycling array being changed into regular expression, avoided the issuable problem of cycling, reduced the front end system expense, improved user's surfing.
Description of drawings
Fig. 1 is the FB(flow block) of the method for a kind of webpage front end of the present invention locator data.
Embodiment
The invention will be further described below in conjunction with the drawings and specific embodiments, but not as limiting to the invention.
The method of a kind of webpage front end of the present invention locator data, comprise the first array, with the first array the second array and the target array of identical element are arranged, store respectively querying condition in the first array and the second array, store the Query Result of expection in the target array, wherein, as shown in Figure 1, specifically comprise the steps;
Step a, the pointer of the first array and the second array indication array interior element is pointed to respectively separately the first element;
Step b, target array interior element is in turn connected into target strings in order, and with target strings changed string form;
Step c, be instructed in according to the pointer of the first array and obtain the first key word in the first array and obtain the second key word in the second array according to being instructed in of the second array pointer simultaneously;
Steps d, the first key word and the second key word are connected into keyword string, and with keyword string changed string form;
Step e, utilize regular expression to check whether keyword string is present in the target strings, and with predetermined policy record check result;
The pointed of the pointer of step f, the first array and the second array is the next element of order of place array separately;
Whether the array element of the pointed of step g, inspection the first array exists, and withdraws from as not existing then, then returns step c continuation execution as existing.
Further, wherein, predetermined policy does not then return vacation for not being present in such as keyword string among the step e in the target strings, as keyword string exist with target strings in then resolve part that the target strings reduction comprises keyword string in the position of target array interior element, return element corresponding to this position and return very.
Further, wherein, step a carries out by the script that is embedded in the hypertext document to step g and above-mentioned predetermined policy, and wherein script can be write formation by JavaScript, VBScript or other scripts.
The above only is preferred embodiment of the present invention; be not so limit claim of the present invention; so the means that the equivalent structure that all utilizations instructions of the present invention and diagramatic content have been done changes and those skilled in the art habitually practise are replaced, and all are included in protection scope of the present invention.