Wednesday 8 January 2014

Google Tranallator in php

Google API Translator in PHP file: 

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta name="google-translate-customization" content="bac05922687cae8e-236a0f2245013f08-g7adb1266d3e9e6e3-1a"></meta>
        <title></title>
        <script type="text/javascript">
          // Javascript function which takes care for multiple uploads
          var attachmentlimit = 5; // Limiting maximum uploads to 5
          var attachmentid = 1;
          function attachmore() { // Function is called when user presses Attach Another File
            attachmentid += 1;
            document.getElementById('attachmentdiv').innerHTML += '<div id="attachmentdiv_' + attachmentid + '" style="margin-top:5px"><input type="file" id="attachment_' + attachmentid + '" name="attachment_' + attachmentid + '" size="30" onchange="document.uploadattachments.submit();"/></div>';
            if(attachmentid == attachmentlimit) {
              document.getElementById('addanother').style.display='none';
            }
          }
        </script>
        <script type="text/javascript">
function googleTranslateElementInit() {
  new google.translate.TranslateElement({pageLanguage: 'en', layout: google.translate.TranslateElement.InlineLayout.SIMPLE}, 'google_translate_element');
}
</script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
    </head>
    <body>
        <form action="test1.html" />
        <div id="google_translate_element"></div>
        <form action="controller/Controller.php" method="POST">
            <table>
                <tr>
                    <td>
                        <label>Username:</label>
                    </td>
                    <td>
                        <input type="text" name="user"/>
                    </td>
                </tr>
                <tr>
                    <td>
                        <label>Password:</label>
                    </td>
                    <td>
                        <input type="password" name="pass"/>
                    </td>
                </tr>
                <tr>
                    <td>
                        <input type="submit" value="submit" />
                    </td>
                    <td>
                        <input type="reset" value="Cancel" />
                    </td>
                </tr>
            </table>
        </form>
        <form id="uploadattachments" enctype="multipart/form-data" name="uploadattachments" target="attachmentiframe" action="upload.php" method="post">
          <div id="attachmentdiv" style="margin-left:30px">
            <iframe name="attachmentiframe" style="display:none"></iframe>
            <div id="attachmentdiv_1" style="margin-top:5px">
                <input type="file" id="attachment_1" name="attachment_1" size="30" onchange="document.uploadattachments.submit();"/>
            </div>
          </div>
          <!-- div showing error message for invalid file type -->
          <div id="typeerrormessage" style="display:none;margin-left:30px">
            <font color=#990000 size=1>Only png, jpg and gif file type are supported</font>
          </div>
          <!-- div showing error message for exceeded file size -->
          <div id="sizeerrormessage" style="display:none;margin-left:30px">
            <font color=#990000 size=1>File exceeded maximum allowed limit of 100 Kb</font>
          </div>
          <div id="addanother" style="margin-left:30px;margin-top:5px">
            <a href="javascript:void(0)" onclick="attachmore();"><font size=2>Attach another file</font></a>
          </div>
    </form>
    </body>
<style>

#google_translate_element{

left: 900px;

position: relative !important;

top: 20px;

}

.goog-te-gadget img {
display: inline;
}</style>
</html>
Thanks to work from Mr.JDK

No comments:

Post a Comment