Skip to content

Instantly share code, notes, and snippets.

@mfrancois
Last active August 29, 2015 13:56
Show Gist options
  • Select an option

  • Save mfrancois/9076206 to your computer and use it in GitHub Desktop.

Select an option

Save mfrancois/9076206 to your computer and use it in GitHub Desktop.
Tutorial javascript step_0
document.getElementById('hello').innerHTML = "Hello World !";
document.getElementById('hello').addEventListener('click',function(event){
event.preventDefault();
event.target.style.backgroundColor = "#00FFFF";
});
window.addEventListener('load',function(){
document.getElementById('hello').innerHTML = "Hello World !";
document.getElementById('hello').addEventListener('click', function (event) {
event.preventDefault();
event.target.style.backgroundColor = "#00FFFF";
});
});
<!DOCTYPE html>
<html>
<head>
<title>Tutorial Javascript</title>
</head>
<body>
<script type="text/javascript">
alert('Hello World !');
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Tutorial Javascript</title>
</head>
<body>
<div id="hello"></div>
<script type="text/javascript">
document.getElementById('hello').innerHTML = "Hello World !";
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Tutorial Javascript</title>
</head>
<body>
<div id="hello"></div>
<script type="text/javascript">
document.getElementById('hello').innerHTML = "Hello World !";
document.getElementById('hello').addEventListener('click',function(event){
event.preventDefault();
event.target.style.backgroundColor = "#00FFFF";
});
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Tutorial Javascript</title>
<script type="text/javascript" src="app.js"></script>
</head>
<body>
<div id="hello"></div>
<script type="text/javascript">
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Tutorial Javascript</title>
<script type="text/javascript" src="app.js"></script>
</head>
<body>
<div id="hello"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment