How to add the daily spoken and word-based translation functions to your blog

Source: Internet
Author: User

I wrote this article a few days ago.ArticleAll the functions mentioned are based on the services provided by dict.cn. The website dict.cn was accidentally discovered and feels very good. The use of Ajax technology can be said to be pure. I also like his entire operation model very much. It is a typical application of LIBA in Web 2.0. You can check it out if you have time. Www.dict.cn

Let's take a look at the daily oral function on my blog (pinzui.blogcns.com). It is actually very simple to implement this function, that is, to draw a div on the homepage, then we can put the script that shows the daily spoken language from dict.cn on it. Of course, the only thing worth noting is the DIV priority, because if the custom div is overwritten by the above Div if its priority is not specified, it cannot be displayed. BelowCodePut it in the Custom CSS module of the blog garden background.

# Topdictcn{Position:Absolute;Font-size:12px;Left:200px;Top:96px;Z-Index:100;}

The above layer Z-index is defined as one hundred, so that he can be at the top, and then add the following code in the header HTML code.

 <  Div   ID = "Topdictcn"  >  <  Span   ID = "Dict_daily"  >  <  A   Href = "Http://dict.cn /"   Target ="_ Blank"  > Dict. cn </  A  >  </  Span  >  <  Script   Language = "JavaScript"   SRC = Http://dict.cn/daily.php"   Defer = "Defer" >  </  Script  >  </  Div  > 
 
Next, let's take a look at how to add the word translation function, which is actually very simple. Add the following code
<Script SRC=Http://dict.cn/hc" Type="Text/JavaScript"></Script><Script Type="Text/JavaScript">Dictinit ();</Script> 
 
You can also add a word translation switch, and add the following code to the desired position.
<Span ID="Dict_status"></Span>

The specific effect can be seen on my blog. I didn't enable the word translation function, because my blog is all in Chinese, and it seems to be a bit redundant to start word translation.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.