Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="bg">
- <head>
- <meta charset="utf-8">
- <title></title>
- <script>
- function myFunction1(){
- var el = document.getElementById('text');
- var style = window.getComputedStyle(el, null).getPropertyValue('font-size');
- var fontSize = parseFloat(style);
- if(fontSize<72){
- el.style.fontSize = (fontSize + 1) + 'px';
- }
- }
- function myFunction2(){
- var el = document.getElementById('text');
- var style = window.getComputedStyle(el, null).getPropertyValue('font-size');
- var fontSize = parseFloat(style);
- if(fontSize>60){
- el.style.fontSize = (fontSize - 1) + 'px';
- }
- }
- </script>
- </head>
- <body>
- <p id="text" style="font-size:60px;">текст</p>
- <button type="button" onclick="myFunction1()">A+</button>
- <button type="button" onclick="myFunction2()">A-</button>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement