<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>getElementById.html</title> <Meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <Meta http-equiv="description" content="this is my page"> <Meta http-equiv="content-type" content="text/html; charset=UTF-8"> <!--<link rel="stylesheet" type="text/css" href="./styles.css">--> </head> <body> <form name="form1" action="test.html" method="post" > <input type="text" name="username" value="国庆六十周年_1" id="tid" onchange="" > <input type="button" name="ok" value="保存1" /> </form> </body> <script type="text/javascript"> //输出<input type="text" name="username" value="国庆六十周年_1" id="tid">标签value属性的值 var inputElement=document.getElementById("tid"); alert(inputElement.value); //输出<input type="text" name="username" value="国庆六十周年_1" id="tid">标签type属性的值 alert(inputElement.type); </script> </html>
</pre><pre name="code" class="html">
就是很简单的得到相应的标签!!!
大家随意看一看就可以了
原文地址:https://www.jb51.cc/ajax/164655.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。