<form id="mytest" name="mytest"> <input type="text" name="test" value="" onchange="javascript:mycome();"> </form><script language ="javascript"> function mycome(){ alert("this is result") }document.forms[0].elements[0].value="that is a Javascript"; document.mytest.test.select(); document.mytest.blur(); </script>
<Form id="mytest" name="mytest"> <input type="text" name="test" value="" onchange="javascript:mycome()"> </form> ... <script language="JavaScript"> function mycome() { alert("this is result"); document.forms[0].test.value="that is a Javascript"; } </script>
有必要一定要<script>放在最前面</script><head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>无标题文档</title> <script> function mycome() { alert("this is result"); } document.forms[0].elements[0].value="that is a Javascript"; document.mytest.select(); document.mytest.blur(); </script> </head> <body> <Form id="mytest" name="mytest"> <input type="text" name="test" value="" onchange="mycome()"> </form> </body> </html>
<input type="text" name="test" value="" onchange="javascript:mycome();">
</form><script language ="javascript">
function mycome(){
alert("this is result")
}document.forms[0].elements[0].value="that is a Javascript";
document.mytest.test.select();
document.mytest.blur();
</script>
<input type="text" name="test" value="" onchange="javascript:mycome()">
</form>
...
<script language="JavaScript">
function mycome()
{
alert("this is result");
document.forms[0].test.value="that is a Javascript";
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script>
function mycome()
{
alert("this is result"); } document.forms[0].elements[0].value="that is a Javascript"; document.mytest.select(); document.mytest.blur(); </script>
</head>
<body>
<Form id="mytest" name="mytest"> <input type="text" name="test" value="" onchange="mycome()"> </form>
</body>
</html>