0
How am i make a java script link?
2 Antworten
0
<html><head></head><body><script>
var a = document.createElement('a');
var linkText = 'my link text';
a.appendChild(linkText);
a.title='my title for link';
a.href='http://google.com';
document.body.appendChild(a);
</script></body></html>
0
If you need to insert link in your html code using javascript, you can try this method:
In HTML add <div id="yourid">
And in JS,
function addLink() {
document.getElementById('yourid').innerHTML = '<a href="url">Click me</a>';
}