<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script type="text/javascript">
var xmlHttp=false;
try{
xmlHttp=new XMLHttpRequest();
}catch(e){
try{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}catch(e2){
try{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}catch(e3){
xmlHttp=false;
}
}
}
function call()
{
var hanzi=document.getElementById("hanzi").value;
if(hanzi==null||hanzi=="")
return ;
var url="pingyin.php?hanzi="+hanzi;
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange=chang_to_pingyin1;
xmlHttp.send();
}
function chang_to_pingyin1()
{
if(xmlHttp.readystate==4)
{
if(xmlHttp.status==200)
{
var pingyin1=xmlHttp.responseText;
document.getElementById("1").value=pingyin1;
}
else
alert("The status is "+xmlHttp.status);
}
}
function call2()
{
var hanzi=document.getElementById("hanzi2").value;
if(hanzi==null||hanzi=="")
return ;
var url="pingyin.php?hanzi="+hanzi;
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange=chang_to_pingyin2;
xmlHttp.send();
}
function chang_to_pingyin2()
{
if(xmlHttp.readystate==4)
{
if(xmlHttp.status==200)
{
var pingyin2=xmlHttp.responseText;
document.getElementById("2").value=pingyin2;
}
else
alert("The status is "+xmlHttp.status);
}
}
function call3()
{
var hanzi=document.getElementById("hanzi3").value;
if(hanzi==null||hanzi=="")
return ;
var url="pingyin.php?hanzi="+hanzi;
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange=chang_to_pingyin3;
xmlHttp.send();
}
function chang_to_pingyin3()
{
if(xmlHttp.readystate==4)
{
if(xmlHttp.status==200)
{
var pingyin3=xmlHttp.responseText;
document.getElementById("3").value=pingyin3;
}
else
alert("The status is "+xmlHttp.status);
}
}
function call4()
{
var hanzi=document.getElementById("hanzi4").value;
if(hanzi==null||hanzi=="")
return ;
var url="pingyin.php?hanzi="+hanzi;
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange=chang_to_pingyin4;
xmlHttp.send();
}
function chang_to_pingyin4()
{
if(xmlHttp.readystate==4)
{
if(xmlHttp.status==200)
{
var pingyin4=xmlHttp.responseText;
document.getElementById("4").value=pingyin4;
}
else
alert("The status is "+xmlHttp.status);
}
}
</script>
</head>
<body>
输入汉字:
<input name="hanzi" type="text" id="hanzi" onKeyup="return call();"/>
<input name="hanzi2" type="text" id="hanzi2" onKeyup="return call2();"/>
<input name="hanzi3" type="text" id="hanzi3" onKeyup="return call3();"/>
<input name="hanzi4" type="text" id="hanzi4" onKeyup="return call4();"/>
<br />
<input name="1" type="hidden" id="1" onpropertychange="javascript:document.getElementById('pingyins').value=document.getElementById('1').value+document.getElementById('2').value+document.getElementById('3').value+document.getElementById('4').value;"/>
<input name="2" type="hidden" id="2" onpropertychange="javascript:document.getElementById('pingyins').value=document.getElementById('1').value+document.getElementById('2').value+document.getElementById('3').value+document.getElementById('4').value;"/>
<input name="3" type="hidden" id="3" onpropertychange="javascript:document.getElementById('pingyins').value=document.getElementById('1').value+document.getElementById('2').value+document.getElementById('3').value+document.getElementById('4').value;"/>
<input name="4" type="hidden" id="4" onpropertychange="javascript:document.getElementById('pingyins').value=document.getElementById('1').value+document.getElementById('2').value+document.getElementById('3').value+document.getElementById('4').value;"/><br />
拼音助记:
<input name="pingyins" type="text" id="pingyins"/>
</body>
</html>