<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>自定义标签属性的使用</title> <script type="text/javascript" src="../js/jquery-1.8.3.js"></script> </head> <body> <hr> <h1>自定义标签属性</h1> 自定义标签属性:<input id="zval" type="button" value="测试" zval = "自定义属性的值为:111" onclick="showAttrVal(this)" > </body> <script type="text/javascript"> function showAttrVal(obj){ alert("自定义属性:"+$(obj).attr("zval")) alert("value="+$(obj).val()) } </script> </html>