Firefox中的Google音译API问题
|
我正在尝试在Firefox 4.0.1和WindowsXP中使用Google Transliterate API helloWorld
我正在使用node.js 0.4.7来提供页面
通过node.js加载页面时,出现以下错误:“试图在已清除的作用域上运行编译脚本”
如果我双击该页面并在Firefox中从磁盘打开它,或者在IE8,Opera或Chrome中打开它,则页面渲染成功
知道为什么会发生这种情况以及如何解决吗?这是代码:
<html>
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>
<script type=\"text/javascript\" src=\"https://www.google.com/jsapi?api-key-here\">
</script>
<script type=\"text/javascript\">
// Load the Google Transliterate API
google.load(\"elements\", \"1\", {
packages: \"transliteration\"
});
function onLoad() {
var options = {
sourceLanguage:
google.elements.transliteration.LanguageCode.ENGLISH,
destinationLanguage:
[google.elements.transliteration.LanguageCode.URDU],
shortcutKey: \'ctrl+g\',
transliterationEnabled: true
};
// Create an instance on TransliterationControl with the required
// options.
var control =
new google.elements.transliteration.TransliterationControl(options);
// Enable transliteration in the textbox with id
// \'transliterateTextarea\'.
control.makeTransliteratable([\'transliterateTextarea\']);
}
google.setOnLoadCallback(onLoad);
</script>
</head>
<body>
Type in Urdu (Press Ctrl+g to toggle between English and Urdu)<br>
<textarea id=\"transliterateTextarea\" style=\"width:600px;height:200px\"></textarea>
</body>
</html>
没有找到相关结果
已邀请:
0 个回复