日期:2014-05-16 浏览次数:20365 次
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>改变Input Value值</title> <script type="text/javascript"> function changeValue(){ var value = document.getElementById("inputID"); if(value.value!=""){ value.value="" } else{ value.value ="2"; } } </script> </head> <body> <div id="content"> <input type='text' name='name' id='inputID' value='1'> <input type='button' name='name' id='name' value='改变值' onclick = "changeValue()"> </div> </body> </html>