Background technology
When exploitation webpage, often all needing to rely on many personnel with professional knowledge and technology uses specific application software to carry out on computers the editor of webpage, after webpage completes editor, then by developer, webpage is uploaded to the server that website service is provided.
Early stage webpage is mainly by HTML (Hypertext Markup Language) (HyperText Markup Language, HTML) grammer and script (script) form, the developer of webpage is programmer mostly, but recently due to style sheet (CSS) in webpage by a large amount of uses, therefore the developer of webpage, except programmer, has also increased the visual designer completely not identical with programmer's professional domain.Therefore, the flow process of webpage development is normally made after the webpage that has added pattern grammer by visual designer at present, transfers to programmer in this webpage, to write to browser and the program of carrying out on to server.
But, due in the process of webpage development, the picture that webpage presents and the constantly adjustment of function that operation is provided, in addition, because the source code of webpage is not by same person editor, but by visual designer and programmer's joint development, therefore, after visual designer and programmer carry out editor again and again to the source code of webpage, the source code of webpage can be more and more mixed and disorderly, under these circumstances, once the picture that webpage will present or the complexity of procedure code improve, it is more and more longer that the source code of webpage can become, to become increasingly complex, so, visual designer is difficult for revising the pattern grammer in webpage, and programmer is also difficult for revising the script in webpage.In addition, because visual designer is unfamiliar with script grammer conventionally, programmer may be unfamiliar with pattern grammer, so, when visual designer and programmer are when revising the source code of webpage, often dare not delete unfamiliar script grammer or pattern grammer, so by easily causing in the source code of webpage, occur unnecessary script grammer or pattern grammer.
In sum, since known prior art is medium-term and long-term, there is the webpage source code easy care and easily occur the problem of unnecessary grammer not simultaneously comprise HTML grammer, pattern grammer and script grammer always, therefore be necessary to propose improved technological means, solve this problem.
Summary of the invention
Because there is the webpage source code easy care and easily occur the problem of unnecessary grammer not comprise HTML grammer, pattern grammer and script grammer in prior art simultaneously, so the present invention discloses a kind of interactive element of searching to carry out system and the method thereof of corresponding script, wherein:
Search interactive element disclosed in this invention, to carry out the system of corresponding script, at least comprises: load module; Webpage insmods, and in order to be written into the target web that comprises at least one script function, does not comprise script grammer in the label of target web; Web Page Processing module, in order to the script according in target web, produce element and search unit and script executing unit, element is searched unit and is used to search in target web and comprises the element that is transfused to the interactive event that module triggers, and script executing unit is in order to be used element carry out the script function of corresponding interactive event and produce execution result; Display module, in order to the display web page loaded target web that insmods, and in order to according to execution result change display-object webpage.
Search interactive element disclosed in this invention is to carry out the system of corresponding script, and wherein, it is XML path language (XML Path Language, XPath) iterator and/or CSS iterator that element is searched unit; Interactive event is that cursor movement to element, cursor shifts out element, cursor is clicked element; Execution result is the show or hide of content and/or the change of attribute of an element of element.
Search interactive element disclosed in this invention is to carry out the system of corresponding script, and wherein, target web can also comprise the link of the function shelves that record script function, and webpage insmods and more in order to the link according to function shelves, is written into function shelves; Target web also can comprise the link of the pattern shelves of the pattern grammer that record uses, and webpage insmods more in order to the link load style shelves according to pattern shelves.
Search interactive element disclosed in this invention is to carry out the method for corresponding script, and its step at least comprises: be written into the target web that comprises at least one script function, do not comprise script grammer in the label of target web; Display-object webpage; Trigger the interactive event that the element in target web comprises; In target web, search element; Use element to carry out the script function corresponding with interactive event, so as to producing execution result; According to execution result change display-object webpage.
Search interactive element disclosed in this invention is to carry out the method for corresponding script, wherein, the step that is written into the target web that comprises script function can comprise according in target web, record the link of function shelves, be written into the step of the function shelves that comprise script function, or comprise according in target web, record the link of pattern shelves, be written into the step of the pattern shelves that comprise pattern grammer.
Search interactive element disclosed in this invention is to carry out the method for corresponding script, and wherein, the step that changes display-object webpage according to execution result is the content of show or hide element and/or shows the attribute of an element being changed by execution result.
System and method for disclosed in this invention as above, and the difference between prior art is that the present invention passes through addition element in target web and searches unit, after interactive event in target web is triggered, element is searched unit can hunt out the element that comprises the interactive event being triggered, the script grammer corresponding with interactive event is performed, so as to solving the existing problem of prior art, and can reach the technology effect that improves the efficiency of developing/safeguard webpage and procedure code.
Embodiment
Below will coordinate graphic and embodiment to describe feature of the present invention and embodiment in detail, content is enough to make any related art techniques person of haveing the knack of can fully understand easily the applied technological means of technical solution problem of the present invention and implement according to this, realizes whereby the attainable effect of the present invention.
The present invention is that in target web, add can be after interactive event occurs, in automatic searching target web, produce the script of the element (element) of interactive event, make to change in the show state of element or the target web of content with script, can can be separated with the script being performed by being used for specially HTML grammer and pattern (CSS) grammer of display web page element, and do not need to be mixed in same place, do not write.That is to say, use the present invention, can not comprise any script grammer so that be used for describing the label of each element of target web, facilitate visual designer to set up and modifying target webpage.Wherein, the script that the present invention carries, is the set of the particular script grammer in target web, can or be comprised of one or more script grammers and one or more script function a plurality of script grammers, one or more script function; The script function that the present invention carries is comprised of a plurality of script grammers, and it can reach specific function.
The interactive event that the present invention carries triggers for user can operate cursor the event that the element in target web comprises, onmouseover () event, the cursor triggering such as cursor movement to element shifts out element onmouseout () event, cursor is clicked element onclick () event etc., but the present invention is not as limit.
The search interactive element that following elder generation is carried with Fig. 1 the present invention illustrates System Operation of the present invention to carry out the system architecture diagram of corresponding script.As shown in Figure 1, system applies of the present invention, in the browser 100 of webpage, wherein comprises that webpage insmods 110, load module 120, Web Page Processing module 130 and display module 140.
Webpage insmods and 110 is responsible for being written into target web, wherein, by webpage 110 target webs that are written into that insmod, is stored in the device of carrying out browser 100, and generally speaking, the device of carrying out browser 100 can store target webs with Storage Media 400.
Webpage insmods 110 loaded target webs can be for writing the different piece at archives by HTML grammer and pattern grammer and script grammer, in the case, HTML grammer in target web and pattern grammer and script grammer have significantly and separate, and do not have the grammer being mingled with.Target web also can be for comprising the archives of the link with the HTML grammer of pattern title, the link of function shelves and pattern shelves, webpage insmods 110 meetings after being written into target web, according to the link of function shelves and the link of pattern shelves, to Storage Media 400, read the function shelves that record script function and the pattern shelves that record pattern grammer, so as to completing being written into of target web.
Load module 120 is responsible for providing the interactive event that in triggering target web, a certain element comprises.Generally speaking, the viewer that load module 120 is to provide target web operates cursor and moves and click, and shifts out element, cursor is clicked the interactive event such as element so as to triggering cursor movement to element, cursor.
Web Page Processing module 130 is responsible for producing element according to the script in target web and is searched unit 132 and script executing unit 136, so as to the corresponding script of interactive event in target web can normally be carried out.
Element is searched unit 132 and is responsible for to search in target web and comprises the element that is transfused to the interactive event that module 120 triggers.Element is searched the tree (tree) that unit 132 can be considered as target web data structure, and the node (node) of tree is the element in target web, therefore, element is searched unit 132 can use for XML path language (XML Path Language, XPath) iterator and/or CSS iterator etc. the element of similar techniques.
Script executing unit 136 is responsible for using element to search the element that comprises the interactive event the being triggered execution script corresponding with the interactive event being triggered that unit 132 hunts out, by script executing unit 136 execution scripts, be generally the form of function, but the present invention is not as limit.Wherein, if target web records in the mode linking the function shelves that comprise script function, the script function corresponding with the interactive event being triggered can be recorded in function shelves conventionally, but the present invention is not also as limit.
Script executing unit 136, after carrying out the script corresponding with the interactive event being triggered, can produce corresponding execution result.The execution result that script executing unit 136 produces is the show or hide of the content of the one or more elements in target web, and/or the change of the one or more attributes of an element (attribute) in target web, but the present invention is not as limit.Wherein, the element that content is shown or is hidden is the element such as " <div ... > ... </div> ", " <li ... > ... </li> " for example, but the present invention is not as limit; And the reformed element of attribute is including but not limited to picture element <img ... >, link element <a ... ></a> etc., reformed attribute can be picture path, coupling position, pattern grammer, data content etc., and the present invention is not as limit.
Display module 140 is responsible for each label insmoding in 110 loaded target webs according to webpage, each element of target web is presented in browser 100, display module 140 is also responsible for the execution result producing according to script executing unit, the show state of each element of change display-object webpage or shown data content.
Then with an embodiment, explain orally operation system of the present invention and method, and please refer to search interactive element that Fig. 2 the present invention puies forward to carry out the method flow diagram of corresponding script.
When viewer's wish is used browser 100 browsing objective webpage 301, viewer understands webpage in operating browser 100 and insmods and 110 be written into target web 301 (step 210).In the present embodiment, hypothetical target webpage 301 is with concept development of the present invention, target web 301 will be as shown in Figure 3A, at " <ul ... > ... </ul> " " <li ... > ... </li> ", " <div ... > ... </div> ", " <span ... > ... </span> ", simple HTML grammers such as " <a href=... > ... </a> ", and " class=" ... " ", " style=" ... pattern grammers such as " ", and do not comprise any script grammer.Wherein, if target web 301 does not directly comprise pattern grammer/script grammer, but comprise, be attached to the pattern shelves/script files that records pattern grammer/script grammer, webpage insmod 110 can comprise according to target web 301 the link of pattern shelves/script files, download pattern shelves/script files, so as to the pattern grammer/script grammer in load style shelves/script files.
At webpage, insmod and 110 be written into after target web 301 (step 210), display module 140 can demonstrate target web 301 (step 220) in the user interface of browser 100, makes load module 120 provide user to operate the interactive event (step 230) that cursor triggers certain element in target web 301.In the present embodiment, suppose that the interactive event being triggered is that cursor movement is to element, when user is when by load module 120, by cursor movement, to element 330, on the user interface at browser 100, the object (object) of representative is upper, the interactive event that element 330 comprises is triggered.
Afterwards, the element in Web Page Processing module 130 is searched unit 132 and can in target web 301, be searched the element (step 250) that comprises the interactive event being triggered.In the present invention, suppose that element searches unit 132 for " XPath iterator ", element is searched unit 132 can to search smoothly the element that comprises the interactive event being triggered is element 330.
Element in Web Page Processing module 130 is searched unit 132 and in target web 301, is searched after the element (step 250) that comprises the interactive event being triggered, script executing unit 136 in Web Page Processing module 130 can be used by element and search the element execution script function corresponding with interactive event that unit 132 is hunted out, so as to producing execution result (step 260).In the present embodiment, suppose that script 302 in the script function corresponding with interactive event as shown in Figure 3 B, when element 330 content when interactive event is triggered is demonstration (visible), script executing unit 136 can be carried out the script grammer 381 in script 302, so, the content that the hiding element 330 of script executing unit 136 meeting generation comprises and the execution result of changing the picture of a certain picture element in target web 301; And if element 330 content when interactive event is triggered is hiding (hide), script executing unit 136 can be carried out the script grammer 382 in script 302, so, the content that script executing unit 136 meeting generation display elements 330 comprise and the execution result of changing the picture of a certain picture element in target web 301.
Script executing unit 136 in Web Page Processing module 130 is carried out the script function corresponding with the interactive event being triggered and is produced after execution result (step 260), and display module 140 can execution result change display-object webpage.In the present embodiment, the execution result that namely display module 140 can produce according to script executing unit 136 is hidden or the content of display element 330, and to change the element that Shows Picture be corresponding picture.So, the script in target web 301 can separate and write with HTML grammer and pattern grammer, and reaches same display effect.
In sum, difference between known the present invention and prior art is to have addition element in target web and searches unit, after interactive event in target web is triggered, element is searched unit can hunt out the element that comprises the interactive event being triggered, the technological means that the script grammer corresponding with interactive event is performed, by this technological means, can solve the existing HTML grammer that simultaneously comprises of prior art, the webpage source code of pattern grammer and script grammer is easy care and easily occur the problem of unnecessary grammer not, and then reach the technology effect that improves the efficiency develop/safeguard webpage and procedure code.
Moreover, the element of searching when interactive event triggers of the present invention is to carry out the method for corresponding script, can be implemented in the combination of hardware, software or hardware and software, also can in computer system, with centralized system, realize or intersperse among with different elements the dispersing mode of the computer system of some interconnection and realize.
Although embodiment disclosed in this invention as above, just described content is not in order to direct restriction scope of patent protection of the present invention.Any persond having ordinary knowledge in the technical field of the present invention, is not departing under the prerequisite of spirit and scope disclosed in this invention, to doing a little change retouching in the formal and details of enforcement of the present invention, all belongs to scope of patent protection of the present invention.Scope of patent protection of the present invention, still must with appended claim the person of being defined be as the criterion.