0
Code don't work
i try to create a javascript code to create links but i can't understand why "show code" button don't work. https://code.sololearn.com/WK8YWg9ZGSO6/?ref=app https://code.sololearn.com/WK8YWg9ZGSO6/?ref=app
3 Antworten
+ 20
var link= prompt("insert the url of your site")
if (link)
var text= prompt("insert the text to show")
window.onload = function() {
var el = document.getElementsByTagName('a');
el[0].href= link;
var x = document.getElementById('LinkText');
x.text = text ;
var w = document.getElementById('button');
w.onclick =function() {
var z = document.getElementById('codeToShow');
z.innerHTML = "<a href=\""+link+"\">"+text+"</a>";
}
};
copy paste this.....
is this what you want??
+ 2
what do you want it to do?
+ 2
If you are trying to click the link, and go to the website the person put in the prompt, it's really not going to work.
The code playground doesn't work anchor links like that and will just show a blank page on the area of the code playground