Created
October 22, 2016 14:59
-
-
Save edinsoncs/64c3d1b581881500b3af76aa0cbd5283 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Javascript</title> | |
</head> | |
<body id="body"> | |
<button id="show">Show</button> | |
<script> | |
"use strict"; | |
var show = document.getElementById("show"); | |
show.addEventListener('click', () => { | |
var _link = document.createElement('a'); | |
var _text = document.createTextNode('Hola bienvenido a javascript post'); | |
_link.appendChild(_text); | |
_link.href = 'http://facebook.com'; | |
_link.target = '_blank'; | |
var tag = _link | |
//Definition Stylesheet | |
styleToFn(_link); | |
//Send Data | |
appendToFn(tag); | |
//Remove Button | |
var toRemove = show.parentElement.removeChild(show); | |
}); | |
function appendToFn(data){ | |
var body = document.getElementById("body"); | |
body.appendChild(data); | |
} | |
function styleToFn(data) { | |
data.style.background = 'red'; | |
data.style.padding = '20px'; | |
data.style.display = 'block'; | |
data.style.color = 'white'; | |
data.style.border = '10px solid black'; | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment