<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>自定义标签属性</title>
<script language="javascript">
function msg(){
alert(document.form1.textfield.aaa);
}
</script>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<input type="text" aaa="bbb" name="textfield" />
<input type="button" name="Submit" onclick="msg();" value="查看属性" />
</form>
</body>
</html>实践证明自定义的标签属性是可行的,脚本能获取其属性值,这在某些场合这是非常有用的,就像Validator验证类里头。
评论(0)
暂无评论。