1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
<html>
<body>
<a href="/home">BBB</a>
<b id="aaaa">bbb</b>
<a id="blabla" href="/" rel="nofollow">
<b>AAA</b><u id="ble">UUU</u>AAAAAAA
</a>
<a id="bb" href="/">BB</a>
<script>
function aa()
{
var a = document.getElementById('blabla').hasAttribute('rel');
console.assert(a, 'True');
}
function bb()
{
var b = document.getElementById('ble').hasAttribute('href');
console.assert(!b, 'False');
}
console.error('element.hasAttribute.html');
aa();
bb();
console.exit();
</script>
<button onclick="return aa()">blabla rel true</button>
<button onclick="return bb()">ble href false</button>
</body>
</html>
|