日期:2014-05-16 浏览次数:20409 次
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>test_get_element_atts.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">--> <script type="text/javascript"> function get_element_atts_val(obj) { //获取button的value属性的值的各种方法 var value_1 = obj.value; var value_2 = obj.getAttribute("value"); var value_3 = obj.getAttribute("value"); var value_4 = obj.attributes("value").value; //alert(t); alert(value_1 + value_2 + value_3 + value_4); } </script> </head> <body> <!--以value为例 --> 获取button的value属性的值的各种方法 <br /> <input type="button" name="t" id="d" onclick="get_element_atts_val(this)" value="请点击" /> </body> </html>