Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/426.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 谷歌音译在更新面板中不起作用_Javascript_Asp.net_Updatepanel_Google Translator Toolkit - Fatal编程技术网

Javascript 谷歌音译在更新面板中不起作用

Javascript 谷歌音译在更新面板中不起作用,javascript,asp.net,updatepanel,google-translator-toolkit,Javascript,Asp.net,Updatepanel,Google Translator Toolkit,我已经试过这个方法了 . 如果我把谷歌的音译代码从页面外准备好,那么它可以正常工作,但回邮后就不起作用了。 如果我将代码放在page ready事件中,则页面不会加载。请帮帮我 您使用:添加 <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript"> $(document).ready(func

我已经试过这个方法了 . 如果我把谷歌的音译代码从页面外准备好,那么它可以正常工作,但回邮后就不起作用了。 如果我将代码放在page ready事件中,则页面不会加载。请帮帮我

您使用:添加

<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">


    $(document).ready(function () {
        google.load("elements", "1", {
            packages: "transliteration"
        });

        function onLoad() {
            var options = {
                sourceLanguage:
    google.elements.transliteration.LanguageCode.ENGLISH,
                destinationLanguage:
    google.elements.transliteration.LanguageCode.HINDI,

                shortcutKey: 'ctrl+g',
                transliterationEnabled: true
            };
            var control =
new google.elements.transliteration.TransliterationControl(options);
            control.makeTransliteratable(['<%=TextBox1.ClientID%>']);
        }

        // here you make the first init when page load
        google.setOnLoadCallback(onLoad);

        // here we make the handlers for after the UpdatePanel update
        var prm = Sys.WebForms.PageRequestManager.getInstance();
        prm.add_initializeRequest(InitializeRequest);
        prm.add_endRequest(EndRequest);

        function InitializeRequest(sender, args) {
        }

        // this is called to re-init the google after update panel updates.
        function EndRequest(sender, args) {
            onLoad();
        }
    });

</script>

    // update panel with button to make post back
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" />
                    <asp:Label ID="Label1" Text="text" runat="server" />
                    <asp:Button ID="Button1" Text="Postback" runat="server" OnClick="Button1_Click" />
                </ContentTemplate>
            </asp:UpdatePanel>

请帮助我任何人。很紧急
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <asp:TextBox ID="TextBox1" runat="server" />
                <asp:Label ID="Label1" Text="text" runat="server" />
                <asp:Button ID="Button1" Text="Postback" runat="server" OnClick="Button1_Click" />
            </ContentTemplate>
<Triggers>
        <asp:PostBackTrigger ControlID="Button1" />
</Triggers>
        </asp:UpdatePanel>