Javascript
In search engine robot searches, the type,text/html for such "text" is the highest (except at this stage Text/xml), and text/javascript this kind of friendly degree is not ideal, If robot also wants to judge the DHTML code, the complexity is higher and is not zoned, so if you want to increase the friendliness of your code when you are programming with DHTML. A better approach would be to "simplify DHTML code to code that has no HTML as much as possible". How do you understand this sentence?
e.g:
a JavaScript menu.
Method One, adopt the General programming method:
<script type= "Text/javascript" >
var navi_menu = Neverdhtmlmenu ();
/* AddItem method
* @ PID
* @ ID
* @ text
* @ href
*/
Navi_menu.additem ("0", "1", "Home", "http://www.never-online.net");
Navi_menu.additem ("0", "2", "blog", "Http://blog.never-online.net");
Navi_menu.additem ("0", "3", "Music", "Http://www.never-online.net/music");
Navi_menu.init ("Navigator_container");
</script>
Second, the use of search engine more user-friendly programming methods <script type= "Text/javascript" >
onload = function () {
var config = {
Container:document.getElementById ("Navigator_container");
and more Configuration Code
}
var navi_menu = new Nevercssdhtmlmenu (config);
Navi_menu.init ();
</script>
<div id= "Navigator_container" class= "Navigator_menu" >
<ul>
<li><a href= "Http://www.never-online.net" >home</a></li>
<li><a href= "Http://blog.never-online.net" >blog</a></li>
<li><a href= "Http://www.never-online.net/music" >music</a></li>
<!--more ...-->
</ul>
<div>
From the method one and the method to compare, the method a few HTML encapsulated into the Neverdhtmlmenu (), but this does not have the actual benefit, although we can still put CSS into this class.
There are many benefits to be seen in method two, such as separating view from program and implementing MVC for the client. In other words, the development efficiency can be improved.
Some friends may ask, besides menu, what other programs can be separated by the above method?
Above also mentioned, the general interaction with the page more, will produce a lot of HTML, will affect the search engine robot, can use this method, of course, these just discuss the search engine friendliness, so, any code must be based on the actual situation.
Or ask a friend, why would this improve development efficiency?
For example, after the graphic is done, (assuming some of the relevant HTML written by the US Union) is followed by the XHTML standard (as shown above)
Suppose I want to change the original home to default page, then art and programmers to communicate, said to change the word of this menu, communication time in the development will be more. Therefore, in the development progress, this time should be counted. If you want to change the template, then you have to communicate. Or if the original use of JS generated HTML is a table made of menu, to be revised, then the program has to rewrite. Unfavorable to maintain ...
This method suggests that you can try, the main meaning is JS is responsible for business implementation, and view is still left to the HTML to deal with.