At first did not hear the chain outside chain, only the link anchor text, in the interview was asked how to find the page in the chain and outside the chain, thinking, what is the chain and outside the chain ah???????????????????????
Later, the interviewer explained to me their differences, I understand a little bit, I was the answer by getting the href attribute of a tag, find out if there is an href in the string, and then asked how to use the selector? I will not ....
Later came down and thought of this problem, think of their own pig ah, there is a property selector to match, but then why not answer, because this is CSS3, I only know, but not too often used, so the first reaction did not think, in the final analysis is a proficiency problem, did not reach the level of familiarity!
Paste the property selection here
| Selector | Selector
Description |
| [attribute] |
Used to select an element with the specified attribute. |
| [attribute=value] |
Used to select an element with the specified attributes and values. |
| [attribute~=value] |
Used to select the element in the attribute value that contains the specified vocabulary. |
| [attribute|=value] |
Used to select an element with an attribute value that begins with the specified value, which must be the entire word. |
| [attribute^=value] |
Matches each element of the property value to the beginning of the specified value. |
| [attribute$=value] |
Matches each element of the property value to the end of the specified value. |
| [attribute*=value] |
Matches each element of the property value that contains the specified value. |
I went online to check on the chain and outside the chain, a lot of discussion is how to improve the site rankings, and site optimization problems, then how to find the inner chain and the number of the chain? The answer is to provide the webmaster tools, haha, not what I want, put out their own ideas, may have flaws, but to achieve a certain function
The following in their own words to explain the concept of the popular, I hate the official those more jerky words, not to connect the atmosphere
Inner chain: is the internal link of their own site, you can jump to the other pages within their own site anchor text (hyperlinks), such as navigation, etc... For example: <?php echo site_url (' former/services ');? This is Phpci frame form, others have their own style, or a-label href= "#" or href= "javascript:void (0)" or href= "javascript:" etc. also belong to the chain
outside The chain: Outside the chain temporarily learned that there are three types:
- Anchor Text (a word or a sentence has its own link, is linked to other sites, generally http: do the Beginning)
- Plain Text links (just like when we write an article or post a link directly, such as I now paste my blog address http://www.cnblogs.com/lpshan/, it is only a link address, but click can not reach the destination, You need to paste into the address bar)
- anti-chain (assuming there are two pages A and b,b pages through a link to a page, then, B is a anti-chain, ranking optimization when there is such a sentence "inner chain for the king, the outside chain for the Emperor")
1<script type= "Text/javascript" >2$ (document). Ready (function(e) {3 varalllink=$ ("a"). length; Total number of a tags4 varwlink=$ ("a[href^= ' http: ']"). Length;//outer chain5 varnlink=$ ("a[href^= ' <?php ']"). Length;//Inner Chain6 7 varbodystring=$ ("Body"). html ();8 varbodylink= (Nr.split (' http ')). Length-1;//the outer chain inside the body9 TenAlert ("Bodylink" +bodylink+ "total chain:" +alllink+ "Outside the chain has:" +wlink+ ", The chain has:" +nlink); One }); A</script>
Wrote a bodylink because of his doubts, the anti-chain of plain text links, the address is not in the href attribute of the A tag, so for $ ("a[href^= ' http: ']"). Length, plain text link outside the chain can not be found, so think of the following method , you get the contents of the body in the form of a string, and then get the HTTP characters from the string, but there is a problem to note that he will get all of the body, including comments out , there is a disadvantage of it.
As for the above inner chain acquisition, you can get the total number of connections-the chain, because some of the href= "#" or href= "javascript:void (0)" or href= "javascript:" And so on are also within the chain.
Feeling after the interview although the interviewer asked me a few questions, but led me to learn several knowledge, very grateful,;-)
No one in the school to guide themselves, their own mistake to learn to learn that, I feel that the improvement is very limited, learning the front end in addition to their own learning, write projects, it is best to guide, so that the improvement will be relatively faster
Use JS to find the inner chain of the page, outside the chain