Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- HTML code to add buttons
- Add id="body" to the body tag.
- <body id="body" >
- Add code for the buttons:
- <button type="button" onclick="bigger()">Bigger</button>
- <button type="button" onclick="smaller()">Smaller</button>
- JavaScript Code to change font size:
- <script>
- function bigger(){
- document.getElementById('body').style.fontSize='x-large';
- }
- function smaller(){
- document.getElementById('body').style.fontSize='medium';
- }
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement