Click here to Skip to main content
15,891,316 members
Articles / Web Development / XHTML

Fastest & Smallest Vietnamese JavaScript Input Editor

Rate me:
Please Sign up or sign in to vote.
5.00/5 (3 votes)
22 Sep 2010CPOL2 min read 57.4K   802   11  
JavaScript VietUni version 1.7 Final
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>VietUni testing</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta name="author" content="nthachus@gmail.com" />
  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
  <script type="text/javascript" src="vietuni.min.js"></script>
</head>
<body>
<h3>VietUni Testing</h3>
<form action="#" method="post">
<fieldset>
  <legend accesskey="p">Personalia</legend>
  <table border="0" cellspacing="2">
    <tr>
      <th><label for="fullname">Full name</label>:&nbsp;</th>
      <td>
        <input type="text" id="fullname" name="fullname" accesskey="n" tabindex="1" size="32" class="vuni"
          onkeypress="$('#parent').html($(this).val())" />
        <span id="parent"></span>
      </td>
    </tr>
    <tr>
      <th><label for="email">Email</label>:&nbsp;</th>
      <td><input type="text" id="email" name="email" accesskey="e" tabindex="2" size="32" /></td>
    </tr>
    <tr>
      <th><label for="description">Description</label>:&nbsp;</th>
      <td><textarea id="description" name="description" rows="10" cols="50" accesskey="d" tabindex="3" class="vuni"></textarea></td>
    </tr>
    <tr>
      <th><label for="note">Note</label>:&nbsp;</th>
      <td><iframe id="note" name="note" width="420" height="200"></iframe></td>
    </tr>
    <tr>
      <th>&nbsp;</th>
      <td>
        <input type="radio" id="typer_mode_4" name="typer_mode" value="4" checked="checked" /><label
          for="typer_mode_4">AUTO</label>&nbsp;
        <input type="radio" id="typer_mode_1" name="typer_mode" value="1" /><label
          for="typer_mode_1">TELEX</label>&nbsp;
        <input type="radio" id="typer_mode_2" name="typer_mode" value="2" /><label
          for="typer_mode_2">VNI</label>&nbsp;
        <input type="radio" id="typer_mode_3" name="typer_mode" value="3" /><label
          for="typer_mode_3">VIQR</label>&nbsp;
        <input type="radio" id="typer_mode_0" name="typer_mode" value="0" /><label
          for="typer_mode_0">OFF</label>
      </td>
    </tr>
    <tr>
      <th>&nbsp;</th>
      <td><input type="submit" value="Submit" />&nbsp;&nbsp;<input type="reset" value="Reset" /></td>
    </tr>
  </table>
</fieldset>
</form>
<script type="text/javascript">
/* <![CDATA[ */
// Handles body.onload event (may use addLoadEvent method)
$(window).load(function() {
  var vUni = new vietUni();

  if (vUni) {
    // Enables Vietnamese typing for some fields
    $(".vuni").each(function() { vUni.initTyper(this); });

    // Switchs Vietnamese typing method
    $("input[name=typer_mode]").change(function() { vUni.setMethod(parseInt($(this).val())); });

    // Enables rich-text-editor (must after iframe.loaded)
    var doc = window.frames["note"].document;
    if (doc.designMode || doc.contentEditable) {
      doc.designMode = "on";

      vUni.initTyper(doc);
    }
  }
});
/* ]]> */
</script>
</body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Junior)
Vietnam Vietnam
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions