HTML DOM innerHTML Property
Complete Anchor Object Reference
Definition and Usage
The innerHTML property sets or returns the text of a link.
Syntax
anchorObject.innerHTML=text
|
Example
The following example changes the text, URL, and target of a link:
<html>
<head>
<script type="text/javascript">
function changeLink()
{
document.getElementById('myAnchor').innerHTML="W3Schools";
document.getElementById('myAnchor').href="http://www.w3schools.com";
document.getElementById('myAnchor').target="_blank";
}
</script>
</head>
<body>
<a id="myAnchor" href="http://www.microsoft.com">Microsoft</a>
<input type="button" onclick="changeLink()" value="Change link">
</body>
</html>
|
Try-It-Yourself Demos
Change
text, URL, and target of a link
Complete Anchor Object Reference
|
|
|
See why there are 20,000+ Ektron integrations worldwide.
Request an INSTANT DEMO or download a FREE TRIAL today. |
|
|
|