CN108399181A - A method of for data and html web page element to be bound - Google Patents
A method of for data and html web page element to be bound Download PDFInfo
- Publication number
- CN108399181A CN108399181A CN201710069997.XA CN201710069997A CN108399181A CN 108399181 A CN108399181 A CN 108399181A CN 201710069997 A CN201710069997 A CN 201710069997A CN 108399181 A CN108399181 A CN 108399181A
- Authority
- CN
- China
- Prior art keywords
- web page
- html web
- data
- identification strings
- page element
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/958—Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
- G06F16/986—Document structures and storage, e.g. HTML extensions
Landscapes
- Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Document Processing Apparatus (AREA)
Abstract
It is disclosed by the invention a kind of for by the method for data and the binding of html web page element, including the following steps:Step S1 creates an object for storing data when html web page initializes;Step S2 generates a random character string as identification strings;Step S3, will be in the identification strings write-in html web page attribute of an element of generation so that the identification strings are bound with html web page element;Step S4 is to index the data bound will be needed to be added into the object with the identification strings.The beneficial effects of the present invention are:The invention enables data and html web page element to bind together, and can both embody the relevance between data and html web page element, also the problem of avoidable naming conflict.
Description
Technical field
The present invention relates to html web page design fields, more particularly to one kind is for tying up data and html web page element
Fixed method.
Background technology
Currently, JavaScript is very frequent to the operation of html web page in html web page.Some data are from service logic
The upper relevance between the element of html web page is very big.Although the element of html web page can be tied up by Custom Attributes
Some fixed information, but these information are all simple character type information.If directly become using global in JavaScript
Amount records these information, then will produce problems with:1, the relationship of data and html web page element object cannot intuitively be embodied;2、
Global variable is possible to that naming conflict can occur, and unnecessary trouble is caused to Web wrapper.For this purpose, applicant carried out beneficial
Exploration and trial, have found result of the above problems, technical solution described below is in this background
It generates.
Invention content
The technical problems to be solved by the invention:A kind of be used for data and HTML is provided in view of the deficiencies of the prior art
The method of web page element binding, this method can both embody the relevance between data and html web page element, also can avoid name
The problem of conflict.
Following technical scheme may be used to realize in technical problem solved by the invention:
A method of for binding data and html web page element, include the following steps:
Step S1 creates an object for storing data when html web page initializes;
Step S2 generates a random character string as identification strings;
Step S3, will be in the identification strings write-in html web page attribute of an element of generation so that the identifier word
Symbol string is bound with html web page element;
Step S4 is to index the data bound will be needed to be added into the object with the identification strings.
In a preferred embodiment of the invention, in the step S2, the identification strings are by fixed character string
It is constituted with the random digit randomly generated.
In a preferred embodiment of the invention, in the step S3, the identification strings of generation are written
Refer to increasing additional attribute in the element of html web page in html web page attribute of an element, the title of the attribute and fixation
Attribute value is identification strings.
In a preferred embodiment of the invention, it is that index need to the identification strings in the step S4
The data to be bound are added into the object, refer to that the attribute value needs for the identification strings that the object is arranged are bound
Data.
In a preferred embodiment of the invention, in the step S4, the data for needing to bind are HTML nets
Any type of data in page.
As a result of technical solution as above, the beneficial effects of the present invention are:The invention enables data and HTML nets
Page element is bound together, and can both embody the relevance between data and html web page element, also can avoid asking for naming conflict
Topic.
Description of the drawings
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below
There is attached drawing needed in technology description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this
Some embodiments of invention for those of ordinary skill in the art without creative efforts, can be with
Obtain other attached drawings according to these attached drawings.
Fig. 1 is the principle of the present invention flow diagram.
Specific implementation mode
In order to make the technical means, the creative features, the aims and the efficiencies achieved by the present invention be easy to understand, tie below
Conjunction is specifically illustrating, and the present invention is further explained.
Referring to Fig. 1, that provided in figure is a kind of for by the method for data and the binding of html web page element, wrapping of the present invention
Include following steps:
Step S1 creates an object for storing data when html web page initializes;
Step S2, generate a random character string be used as identification strings, the identification strings by fixed character string with
The random digit randomly generated is constituted;
Step S3, will be in the identification strings write-in html web page attribute of an element of generation so that the identifier word
Symbol string is bound with html web page element.Specifically, the identification strings of generation are written in html web page attribute of an element,
Refer to increasing additional attribute in the element of html web page, the title and fixed attribute value of the attribute are identification strings;
Step S4 is to index the data bound will be needed to be added into the object with the identification strings.Specifically,
It is to index the data bound will be needed to be added into the object with the identification strings, refers to the mark that the object is set
The attribute value of character string is the data for needing to bind.It is any type of data in html web page to need the data bound.
A more specific embodiment has been given below, so that illustrating of the invention be used for data and html web page
The method of element binding comprising following steps:
1, a map objects dataCache is created when html web page initializes;
2, binding html web page element and data are created, which is related to two parameters, and parameter 1 is html web page element,
Parameter 2 is the data for needing to bind.First determine whether html web page element there are datakey attributes, if there is with this attribute value
For key, then binding data will be needed to be stored in dataCache;If not having datakey attributes, an identifier word is generated at random
Symbol is gone here and there and is deposited into the datakey attributes of html web page element, and being then key with identification strings will need binding data to deposit
Enter in dataCache.
3, it creates and binding data is obtained according to html web page element, which is related to a parameter, which is HTML nets
Page element.First determine whether incoming element there are datakey attributes, if without directly returning to undefined;If so,
Datakey attribute values are taken out, and iteration dataCache searches data and return with datakey attribute values for key.
The above shows and describes the basic principles and main features of the present invention and the advantages of the present invention.The technology of the industry
Personnel are it should be appreciated that the present invention is not limited to the above embodiments, and the above embodiments and description only describe this
The principle of invention, without departing from the spirit and scope of the present invention, various changes and improvements may be made to the invention, these changes
Change and improvement all fall within the protetion scope of the claimed invention.The claimed scope of the invention by appended claims and its
Equivalent thereof.
Claims (5)
1. a kind of method for binding data and html web page element, which is characterized in that include the following steps:
Step S1 creates an object for storing data when html web page initializes;
Step S2 generates a random character string as identification strings;
Step S3, will be in the identification strings write-in html web page attribute of an element of generation so that the identification strings
It is bound with html web page element;
Step S4 is to index the data bound will be needed to be added into the object with the identification strings.
2. the method as described in claim 1 for binding data and html web page element, which is characterized in that in the step
In rapid S2, the identification strings are made of fixed character string and the random digit randomly generated.
3. the method as described in claim 1 for binding data and html web page element, which is characterized in that in the step
In rapid S3, the identification strings of generation are written in html web page attribute of an element, refer in the element of html web page
Increase additional attribute, the title and fixed attribute value of the attribute are identification strings.
4. the method as described in claim 1 for binding data and html web page element, which is characterized in that in the step
In rapid S4, it is to index the data bound will be needed to be added into the object with the identification strings, refers to that setting is described right
The attribute value of the identification strings of elephant is the data for needing to bind.
5. the method as claimed in claim 4 for binding data and html web page element, which is characterized in that in the step
In rapid S4, the data for needing to bind are any type of data in html web page.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710069997.XA CN108399181A (en) | 2017-02-08 | 2017-02-08 | A method of for data and html web page element to be bound |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710069997.XA CN108399181A (en) | 2017-02-08 | 2017-02-08 | A method of for data and html web page element to be bound |
Publications (1)
Publication Number | Publication Date |
---|---|
CN108399181A true CN108399181A (en) | 2018-08-14 |
Family
ID=63094385
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710069997.XA Pending CN108399181A (en) | 2017-02-08 | 2017-02-08 | A method of for data and html web page element to be bound |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108399181A (en) |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103399746A (en) * | 2013-08-01 | 2013-11-20 | 浙江网新恩普软件有限公司 | Information management system convenient to develop secondarily and development method |
-
2017
- 2017-02-08 CN CN201710069997.XA patent/CN108399181A/en active Pending
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103399746A (en) * | 2013-08-01 | 2013-11-20 | 浙江网新恩普软件有限公司 | Information management system convenient to develop secondarily and development method |
Non-Patent Citations (1)
Title |
---|
CHELEN_JAK: "jQuery.data() 的实现方式", pages 1 - 4, Retrieved from the Internet <URL:https://blog.csdn.net/chelen_jak/article/details/44345407> * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104794177B (en) | A kind of date storage method and device | |
CN103020207B (en) | Browser label page grouping management method and device | |
JP2006164269A5 (en) | ||
CN103714013B (en) | A kind of collocation method and device of the memory space of file system | |
CN103365662A (en) | Method and device for advertisement putting based on stream media advertisement template | |
CN106407485B (en) | A kind of URL De-weight methods and system based on similarity-rough set | |
CN109670081A (en) | The method and device of service request processing | |
CN104331438B (en) | To novel web page contents selectivity abstracting method and device | |
CN106095923A (en) | A kind of method and system adding data of being on the list in orderly list | |
CN103838792A (en) | Method for determining webpage theme | |
CN110020272A (en) | Caching method, device and computer storage medium | |
CN109033173A (en) | It is a kind of for generating the data processing method and device of multidimensional index data | |
CN103593483A (en) | Search method for flash courseware knowledge points | |
CN110020243A (en) | Querying method, device, Internet of Things server and the storage medium of internet of things data | |
CN106649319A (en) | Search result display method and device | |
CN108399181A (en) | A method of for data and html web page element to be bound | |
CN104281604B (en) | Method and system for generating Target Link data dictionary hierarchical tree | |
CN106775994A (en) | The method and device of a kind of metadata cluster catalogue scheduling | |
CN106919615A (en) | Data access method and system | |
CN103631774B (en) | Date storage method and system | |
CN105488056B (en) | A kind of object processing method and equipment | |
CN104516971A (en) | Method for combining background pictures in CSS style file | |
CN104298475B (en) | The optimization method that a kind of data store | |
CN105653624B (en) | Data server and data storage method | |
CN103150368A (en) | Method and device for searching and displaying information |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
CB02 | Change of applicant information |
Address after: 200436 Room 601, Lane 299, Lane 299, JIANGCHANG West Road, Jingan District, Shanghai Applicant after: Geer software Limited by Share Ltd Address before: 200436 Room 601, Lane 299, Lane 299, JIANGCHANG West Road, Zhabei District, Shanghai Applicant before: Geer Software Co., Ltd., Shanghai |
|
CB02 | Change of applicant information | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |