hasAttributes

書式

obj.hasAttributes()

対応

[Firefox 1〜][Safari 1〜][Opera 8〜][Netscape 6〜]

説明

属性が1つでも存在する場合はtrue、そうでない場合はfalseを返します。

サンプルコード [実行]

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=shift_jis">
<title>Sample</title>
<script type="text/javascript"><!--
function checkAttr() {
flag = document.body.hasAttributes();
alert(flag);
}
// --></script>
</head>
<body bgcolor="#fffff0">
<h1>hasAttributes</h1>
<form>
<input type="button" id="myButton" value="Click" onClick="checkAttr()">
</form>
</body>
</html>