<form name=form>
<input name=jts value="" size=10>
<input type="file" name=upf onchange="ty()";>
</form>
<script>
function ty(){
var srcc = document.form.upf.value;
srcc = srcc.toString()
start = srcc.indexOf(".");
end = srcc.length;
ts=srcc.substring(start+1,end);
//swordmaple javascript article.
nts=ts.toLowerCase();
document.form.jts.value=nts;
alert("你选择的文件类型是"+document.form.jts.value+"!");
}
</script>