A kind of method of webpage front-end positioning data
Technical field
The present invention relates to a kind of data enquire method, the method for especially a kind of webpage front-end positioning data.
Background technology
Along with the development of internet technique, the popularity of network is more and more higher, and website have also been obtained significant progress as the main contents supplier of internet. Website is no longer satisfied with the content only providing unified standard but wish can be more with user interaction and then can realize by the demand offer content service of user.
A lot of website is the data, services that user provides data form class, and number of site also can provide some simply to inquire about function for strengthening the interactive experience of user on this basis. Owing to the visit capacity of website is bigger; these are do not affect the script that the overall speed of website generally all adopts front end to explain to realize for the simple queries function of domestic consumer; simultaneously in order to reduce the expense of database; possible Query Result is generally all left in array by this kind of simple queries function in advance; these inquiry functions querying condition are also put in array with existing, so can be converted into usually performs array orientation problem by the script of browser-interpreted simultaneously. Usual method is by the relation of inclusion checking between array that circulates, but may occur when many or multi-condition inquiry at array element causing front end torpor due to systemic circulation or causing front reaction slow owing to 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 positioning mode exists, the present invention provides a kind of and is intended to reduce the method producing front reaction webpage front-end positioning data slowly because performing cyclical operation.
The technical scheme that technical solution problem of the present invention adopts is:
A method for webpage front-end positioning data, comprises the first array and the first array has the 2nd array and the target array of identical element, wherein, specifically comprises the steps;
Step a, by respective first element of pointed of described first array and described 2nd array instruction array interior element;
Step b, described target array interior element is in turn connected into target strings in order, and converts described target strings to character string forms;
Step c, it is instructed in the first array according to described pointer to obtain the first keyword in the 2nd array, obtains the 2nd keyword simultaneously;
Steps d, described first keyword and described 2nd keyword are connected into keyword string, and convert described keyword string to character string forms;
Step e, regular expression is utilized to check whether described keyword string is present in described target strings, and with predetermined policy record check result;
The next element of order of the pointer of step f, described first array and the pointed of described 2nd array place array separately;
Step g, check whether the array element of the pointed of described first array exists, if do not existed, exit, then return step c continue to perform as existed.
The method of above-mentioned webpage front-end positioning data, wherein, predetermined policy described in described step e then returns vacation in target strings as described in not being present in such as described keyword string, as described keyword string exist with as described in then resolve in target strings described target strings reduction comprise as described in keyword string part in as described in the position of target array interior element, return element corresponding to this position and return very.
The method of above-mentioned webpage front-end positioning data, wherein, described step a is performed to described step g by the script being embedded in hypertext document.
The method of above-mentioned webpage front-end positioning data, wherein, described predetermined policy is performed by the script being embedded in hypertext document.
The invention has the beneficial effects as follows:
Checking character string by cyclical operation array being changed into regular expression, avoiding the problem that cyclical operation may produce, reducing front end system expense, it is to increase the surfing of user.
Accompanying drawing explanation
Fig. 1 is the FB(flow block) of the method for a kind of webpage front-end positioning data of the present invention.
Embodiment
Below in conjunction with the drawings and specific embodiments, the invention will be further described, but not as limiting to the invention.
The method of a kind of webpage front-end positioning data of the present invention, comprise the first array and the first array has the 2nd array and the target array of identical element, first array and the 2nd array store querying condition respectively, target array stores the Query Result of expection, wherein, as shown in Figure 1, specifically comprise the steps;
Step a, by the first array and the 2nd array instruction array interior element pointer point to the first respective element respectively;
Step b, target array interior element is in turn connected into target strings in order, and converts target strings to character string forms;
Step c, pointer according to the first array are instructed in the first array to obtain the first keyword and are instructed in the 2nd array to obtain the 2nd keyword according to the 2nd array pointer simultaneously;
Steps d, the first keyword and the 2nd keyword are connected into keyword string, and convert keyword string to character string forms;
Step e, whether keyword string is present in target strings to utilize regular expression to check, and with predetermined policy record check result;
The next element of order of the pointer of step f, the first array and the pointed of the 2nd array place array separately;
Whether the array element of step g, the pointed checking the first array exists, and if do not existed, exits, and then returns step c continuation execution as existed.
Further, wherein, in step e, predetermined policy then returns vacation for not being present in target strings such as keyword string, exists such as keyword string and then resolves target strings in target strings and reduce the part comprising keyword string in the position of target array interior element, returns element corresponding to this position and return true.
Further, wherein, step a is performed to step g and above-mentioned predetermined policy by the script being embedded in hypertext document, and wherein script can be formed by JavaScript, VBScript or other script language compilation.
The foregoing is only preferred embodiment of the present invention; not thereby the claim of the present invention is limited; so equivalent structure change done by all utilizations specification sheets of the present invention and diagramatic content and the usual means of those skilled in the art are replaced, all it is included in protection scope of the present invention.