<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Multi-Language UI Test</title>
<script src="jquery-1.4.2.js" type="text/javascript"></script>
<script src="jquery.multilang.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () { jQuery.setupMultiLang("UI.lang.htm"); $("#dvLangSwitch span").click(function () { var t = $(this).text();
var lang = "DEF";
switch (t) { case "中文":
lang = "DEF";
break;
case "英文":
lang = "ENG";
break;
case "簡中":
lang = "CHS";
break;
}
jQuery.switchLang(lang);
});
$("#btnSubmit").click(function () { var v = $("#txtEmpName").val(); if (v.length == 0) { //呼叫ml函數(Multi-Language縮寫),可以自動換訊息
alert(ml("員工姓名不可空白!")); } else if (v.match("[0-9_!@#$%^&*()<>]")) //可以利用{0}, {1}加入變動內容 alert(ml("員工姓名有無效字元: {0}", v)); });
});
</script>
<style type="text/css">
#dvLangSwitch span
{ color: Blue; text-decoration: underline;
margin-left: 5px; cursor: pointer
}
body, table { font-size: 9pt; } #tblFillForm { width: 400px; } #tblFillForm td { border: 1px solid #dddddd; } td.hdr { text-align: right; padding-right: 10px; } </style>
</head>
<body>
<form id="form1" runat="server">
<div id="dvLangSwitch"><span>中文</span><span>英文</span><span>簡中</span></div>
<div>
<table id="tblFillForm">
<tr><td class="dtml hdr" style="width: 100px">員工姓名</td>
<td><input type="text" id="txtEmpName" /></td></tr>
<tr><td class="hdr"><span class="dtml">通訊選項</span></td><td>
<select id="txtContChan" class="dtml">
<option value="MSN">MSN</option>
<option value="Yahoo">即時通</option>
<option value="Plurk">噗浪</option>
</select>
</td></tr>
<tr><td></td>
<td><input type="button" id="btnSubmit" value="送出" class="dtml" /></td></tr>
</table>
</div>
</form>
</body>
</html>