通过有道翻译API翻译文章中的单词

帮小学英语老师写的,只是对有道API的一个简单应用

Html代码

<html><head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
    <title>有道翻译API</title>
    <meta name="description" content="有道翻译API">
    <link rel="shortcut icon" type="image/x-icon" href="http://shared.ydstatic.com/images/favicon.ico">
    <link rel="stylesheet" type="text/css" href="fanyi.css">
</head>

<body>
<div id="page">
    <div class="mod step">
            <h1 class="hd">第一课</h1>
            <div class="bd">
                <div id="demo" class="content" mode="selector">
                    <div class="test">
                        <div id="YOUDAO_SELECTOR_WRAPPER" bindto="demo" style="display: none; margin: 0px; border: 0px; padding: 0px; width: 320px; height: 240px; "><iframe id="YOUDAO_SELECTOR_IFRAME" frameborder="0" src="about:blank" style="background-color: white; border: 0px; width: 320px; height: 240px; "></iframe></div>
                        <p class="tip">Power troubles may soon be solved</p>

                        <p>In my dual <span>profession</span> as an educator and health care provider, I have worked with numerous children infected with the virus that causes AIDS. The relationships that I have had with these special kids have been gifts in my life. They have taught me so many things, but I have especially learned that great courage can be found in the smallest of packages. Let me tell you about Tyler.</p>

                        <p>Tyler was born infected with HIV: his moth  er was also infected. From the very beginning of his life, he was dependent on <i>medication</i>s to enable him to survive. When he was five, he had a tube surgically inserted in a vein in his chest. This tube was connected to a pump, which he carried in a small backpack on his back. Medications were hooked up to this pump and were continuously supplied through this tube to his bloodstream. At times, he also needed supplemented oxygen to support his breathing.</p>

                                          </div>
                </div>
            </div>
        </div>
</div>
<script type="text/javascript" src="http://fanyi.youdao.com/openapi.do?keyfrom=huichuang&key=386196262&type=selector&version=1.2&translate=on" charset="utf-8"></script>
<script type="text/javascript" src="jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="d.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        YoudaoFanyiApi.webMode.init();
    });
</script>
</body></html>

 CSS代码

扫描二维码关注公众号,回复: 489253 查看本文章

.test p span{color: red; cursor: pointer;font-size: 20px}
.test p b{color: #008000; cursor: pointer;font-size: 20px}
.test p i{color: hotpink; cursor: pointer;font-size: 20px}
body{background: url("bg.jpg") repeat-x 0 0 #FFF}
h2{color:darkorange;font-size: 30px;text-align: center}
.hd{text-align: center}
body,div,p,span,ul,li,h1,h2,h3,form,table,tr,td,img{margin:0;border:0;padding:0;}


.hidden{display:none;}.invisible{visibility:hidden;}
body{overflow-y:scroll;*overflow-y:auto;color:#666;font-size:12px;font-family:arial,sans-serif;}
.bc{color:#1E50A2;}#hd h1 .logo,#globalNav,#globalNav .current a,#globalNav li a:hover,#globalNav li a:active,#website,#website:hover,#developer,#developer:hover,#concept,#news,#case,.ft-a,.ft-c,.step h2,.apply,.apply-again,.selector,.dicter,.fanyier,#side .mod,#side .bd li a,#main .intro .hd,#main .intro .ft,.bd-2 li{background:url(images/bg.png) no-repeat;}#page{width:960px;margin:0 auto;}
#hd h1{float:left;}#hd h1 .logo{background-position:-963px -62px;display:inline-block;width:142px;padding-top:28px;height:0;overflow:hidden;}#globalNav{height:55px;background-position:0 0;font-size:14px;}
.banner dl{margin-bottom:10px;line-height:24px;margin-right:90px;}
.mod h2{text-align:center;height:30px;line-height:30px;background-position:0 -60px;}
.mod h2 .gc{font-weight:normal;margin-left:10px;}
.mod ul li{margin-bottom:4px;}.mod ul li,.mod .content{line-height:24px;}.bd-2{margin:32px 0 -12px;}.bd-2 li{background-position:-2950px -81px;padding-left:20px;}
.lc{text-align:center;padding-bottom:30px;}.lc .bc{font-weight:bold;}.mod .content .test{background:#FFF;border:1px solid #edeeed;margin:8px 0 -12px;padding:20px 29px 0 29px;}.mod .content .select{line-height:12px;vertical-align:top;}.mod .content .select input{margin:0 6px 0 4px;vertical-align:top;*margin-top:-4px;}.mod .content h3{margin-top:20px;}.mod .content .test p{font-size:14px;margin-bottom:25px;}
.mod .content .test .tip{font-size:20px;font-weight:bold;}.bd form .accept{padding-left:100px;}

猜你喜欢

转载自turbo12138.iteye.com/blog/2294311
今日推荐