Suppose you need to switch from one page to another. There are many ways to do this. How do you choose? Can you clearly explain the reasons?
<% -- Link representation -- %>
<Asp: hyperlink id = "hyperlink1" runat = "server" navigateurl = "~ /Default2.aspx "> hyperlink </ASP: hyperlink>
<Asp: linkbutton id = "linkbutton1" runat = "server" postbackurl = "~ /Default2.aspx "> linkbutton </ASP: linkbutton>
<% -- For the sake of appearance, many websites use buttons to replace link -- %>
<Asp: button id = "button1" runat = "server" text = "button" postbackurl = "~ /Default2.aspx "/>
<% -- Link with an image. There are two options -- %>
<Asp: imagebutton id = "imagebutton1" runat = "server" postbackurl = "~ /Default2.aspx "imageurl = "~ /Upup.gif "/>
<Asp: hyperlink id = "hyperlink2" runat = "server" navigateurl = "~ /Default2.aspx "imageurl = "~ /Upup.gif "> </ASP: hyperlink>
If you are still confused, I suggest you check the source code after they generate HTML.
<A id = "hyperlink1" href = "default2.aspx"> hyperlink </a>
<% -- After the hyperlink is parsed into HTML, it corresponds to a simple hyperlink. href points to the page to jump to -- %>
<A id = "linkbutton1" href = "javascript: webform_dopostbackwitexceptions (New webform_postbackoptions (& quot; linkbutton1 & quot;, & quot;, false, & quot; & quot;, & quot; default2.aspx & quot;, false, true) "> linkbutton </a>
<% -- Linkbutton1 is also an anchor tag, but it is actually a jump using JavaScript -- %>
<Input type = "Submit" name = "button1" value = "button" onclick = "javascript: webform_dopostbackwithoptions (New webform_postbackoptions (& quot; button1 & quot;, & quot; & quot;, false, & quot;, & quot; default2.aspx & quot;, false, false) "id =" button1 "/>
<% -- Button is parsed to the input element of type = "Submit", and page Jump is also performed through JavaScript -- %>
<Input type = "image" name = "imagebutton1" id = "imagebutton1" src = "upup.gif" onclick = "javascript: webform_dopostbackwithoptions (New webform_postbackoptions (& quot; imagebutton1 & quot ;, & quot;, false, & quot;, & quot; default2.aspx & quot;, false, false) "style =" border-width: 0px; "/>
<% -- Imagebutton is parsed to the input element of type = "image", and page Jump is also performed through JavaScript -- %>
<A id = "hyperlink2" href = "default2.aspx"> </a>
<% -- After the image URL attribute of Hyperlink is assigned a value, it is resolved to HTML and an IMG is "clipped" in the hyperlink, but href still points to the page to be redirected -- %>
What's the use of this?
It is useful, but today we only talk about Seo.
As for the current search engine technology, JavaScript (including Ajax of course), form elements (such as input), flash and image cannot be read (or difficult. Spider tends to read simple HTML text. Therefore, from the SEO perspective:
1. Do not use JavaScript or forms for page Jump links. If a common <A> </a> function can do the same. Generally, any navigation that cannot be accessed through the standard anchor identifier <A> </a> is not retrieved by the spider. If the client element is used, we should be more likely to note this point; but when using the server-side control after encapsulation and processing, we may be careless.
2. Note that updatepanel does not contain text content. We can perform a simple test:
<Asp: scriptmanager id = "scriptmanager1" runat = "server">
</ASP: scriptmanager>
<Asp: updatepanel id = "updatepanel1" runat = "server">
<Contenttemplate>
<Asp: Label runat = "server" id = "LBL"> </ASP: Label>
<Asp: button id = "button1" runat = "server" text = "button" onclick = "button#click"/>
</Contenttemplate>
</ASP: updatepanel>
Protected void button#click (Object sender, eventargs E)
{
This. LBL. Text = "I generated it by updatepanel, so you cannot see me! ";
}
The source code after being parsed into HTML:
<Div id = "updatepanel1">
<Span id = "LBL"> </span>
<Input type = "Submit" name = "button1" value = "button" id = "submit1"/>
</Div>
This is easy to understand, because, like updatepanel, the page content is generated through the JavaScript function of the page. View the source code. We can see the relevant JavaScript Functions, but not the content generated by the functions. The search engine spider only looks at the source code.
3. When we need to use a pop-up page, the common practice is:
<A href = "#" onclick = "too many open('popup.html ', 'common', 'height = 600, Weight = 800');"> common popup </a>
According to our above explanation, such writing is undoubtedly unfavorable for Seo. Therefore, we should use the following code to ensure the effect of the pop-up window and Seo-friendly. In addition, even if the client's browser does not support or Disable Javascript, the page can jump smoothly.
<A href = "popup.html" onclick = "window. open (this. href, 'seo ', 'height = 600, Weight = 800'); Return false; "target =" _ blank "> Seo popup </a>
<% -- Note: The Return false statement cannot be omitted. -- %>
4. When we want to use a special font (often a topic title), we often use a Chinese character image instead. This is also a troublesome task, because as the title, its content is often very important keywords. If you use images, the spider cannot read them. One possible solution is sifr, but I am not very familiar with it. I searched the internet and it seems that it cannot be applied to Chinese characters.
For images, our common Seo method is to indicate title and ALT, as shown in
However, this is also an "invisible page element", and it is difficult to accurately measure the specific effect. But there are always better than none!
5. Other considerations:
5.1 combine the semantics of HTML tags with CSS, which is different from span and Div, h1 means the title, B means the emphasis, UL, Li means the list ......, These semantic tags give clear instructions to search engines;
5.3 important content is placed at the top of the HTML page (source code rather than Browser display results)
5.5 place large JavaScript segments at the bottom of the page or separate JavaScript files;
5.2 do not use frame layout;
5.3 a large number of viewstates may interfere with "Spider;
5.5 keep in mind: javascript (including Ajax), form elements (such as input), flash and image cannot (or are difficult) be read as far as the current search engine technology is concerned.
Reference: http://www.knowsky.com/542789.html