Skip to content

Instantly share code, notes, and snippets.

@putheakhem
Created November 21, 2017 08:34
Show Gist options
  • Save putheakhem/543c4504d67aabce954e6a5b398570ce to your computer and use it in GitHub Desktop.
Save putheakhem/543c4504d67aabce954e6a5b398570ce to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS DOM paragraph style</title>
</head>
<body>
<p id ='text'>JavaScript Exercises - by Mr Khem Puthea</p>
<div>
// use onclick action
<button id="jsStyle" onclick="jsStyle()">
Style
</button>
</div>
<script>
function jsStyle() {
text.style.fontSize = "14pt"; // change font size
text.style.fontFamily = "Comic Sans MS"; // change font
text.style.color = "green"; // change color
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment