<html>
<head></head>
<body>
<script type="text/javascript">
var a = document.createElement('a');
a.title = "my title text";
a.innerHTML = a.title;
a.href = "http://example.com";
document.body.appendChild(a);
</script>
</body>
</html>
var link = "http://google.com";
var element = document.createElement("a");
element.setAttribute("href", link);
element.innerHTML = "your text";
// and append it to where you'd like it to go:
document.body.appendChild(element);
document.write("<a href='" + link + "'>" + text + "</a>");
document.getElementsByTagName('body')[0].innerHTML += '<a href="'+desiredLink+'">'+desiredText+'</a>';
<script type="text/javascript">
//note that this case can be used only inside the "body" element
document.write('<a href="'+desiredLink+'">'+desiredText+'</a>');
</script>
$('<a href="'+desiredLink+'">'+desiredText+'</a>').appendTo($('body'));
$('body').append($('<a href="'+desiredLink+'">'+desiredText+'</a>'));
var a = $('<a />');
a.attr('href',desiredLink);
a.text(desiredText);
$('body').append(a);
desiredLink
var anchorElem = document.createElement('a');
anchorElem.setAttribute("href", yourLink);
anchorElem.innerHTML = yourLinkText;
document.body.appendChild(anchorElem); // append your new link to the body
<script language="javascript">
<!--
document.write("<a href="www.example.com">");
document.write("Your Title");
document.write("</a>");
//-->
</script>
<script type="text/javascript">
document.write('Your Title'.link('http://www.example.com'));
</script>
<script type="text/javascript">
newlink = document.createElement('a');
newlink.innerHTML = 'Google';
newlink.setAttribute('title', 'Google');
newlink.setAttribute('href', 'http://google.com');
document.body.appendChild(newlink);
</script>