HTML DOM Basis atribut href
Definisi dan Penggunaan
set properti href atau mengembalikan URL halaman referensi untuk semua link.
tatabahasa
baseObject.href=URL
Dukungan Browser
Semua browser utama mendukung atribut href
contoh
contoh
Contoh berikut mengembalikan URL dasar halaman ::
<html>
<head>
<base id="htmldom" href="http://www.w3cschool.cc/jsref/">
</head>
<body>
<p>Base URL is:
<script>
document.write(document.getElementById("htmldom").href);
</script>
</p>
</body>
</html>
<head>
<base id="htmldom" href="http://www.w3cschool.cc/jsref/">
</head>
<body>
<p>Base URL is:
<script>
document.write(document.getElementById("htmldom").href);
</script>
</p>
</body>
</html>
Contoh output di atas:
Base URL is: http://www.w3cschool.cc/jsref/
Coba »
Obyek dasar