<html> <head> <mce:script type="text/javascript"><!-- function chk(){ var numb = document.getElementById('num').value; if(numb%2 == 0) { return '偶数'; }else{ return '奇数'; } } // --></mce:script> </head> <body> <form> <input id="num"/> <input value="确定" type="button" onClick="alert(chk())"> </form></body> <html> 本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/nailwl/archive/2009/12/09/4973926.aspx