0

How am i make a java script link?

8th Sep 2016, 3:26 PM
srabonti khan
srabonti khan - avatar
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>
12th Sep 2016, 3:09 PM
Илья Маклецов
Илья Маклецов - avatar
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>'; }
11th Jan 2017, 10:59 PM
Roman Frolov
Roman Frolov - avatar