+
95
-

如何将网页的input输入框变成输入中文自动填充英文的功能?

如何将网页的input输入框变成输入中文自动填充英文的功能?


网友回复

+
15
-

这个要结合第三方的翻译api接口,百度、阿里云都有,可以自己去申请,最后集成在html代码中,示例如下:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>自动翻译输入框</title>
    <style>
        #translation {
            margin-top: 10px;
            font-size: 16px;
            color: #333;
        }
    </style>
</head>
<body>
    <input type="text" id="inputBox" placeholder="输入中文...">
    <div id="translation"></div>

    <script>
        const inputBox = document.getEleme...

点击查看剩余70%

我知道答案,我要回答