谷歌翻译 API v2
如何从 google 示例 " 获取翻译后的源文本值从 javascript 中休息” 到表单字段中,以便我可以将值发布到另一个目的地。
<form name="somename" method="post" action="domsome.asp">
Some text: <input type="text" name="sometext" value="translated_sourcetext"/><br />
<input type=submit value=Accept id=submit1 name=submit1>
<input type="button">
</form>
How do I get the translated sourcetext value from the google sample "rest from javascript" into the formfield so I can post the value to another destination.
<form name="somename" method="post" action="domsome.asp">
Some text: <input type="text" name="sometext" value="translated_sourcetext"/><br />
<input type=submit value=Accept id=submit1 name=submit1>
<input type="button">
</form>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设您有
translateText
回调参数和函数,如示例文档所示,您应该能够将回调更改为:编辑:
从 example,找到这个:
将其更改为:
所以,而不是设置的innerhtml一个div,我们正在设置您的表单输入的值,如问题中所述。
Assuming you do you have the
translateText
callback parameter and function in place as shown in the example doc, you should be able to change the callback to:EDIT:
From the example, find this:
Change it to this:
So, rather than setting the innerhtml of a div, we are setting the value of your form input, as described in the question.