Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## Решения
- 1. ```js
- const title = document.querySelector('.title');
- title.style.color = 'red';
- ```
- 2. ```js
- const btn = document.querySelector('.hide-btn');
- const para = document.querySelector('.text');
- btn.addEventListener('click', () => {
- para.style.display = 'none';
- });
- ```
- 3. ```js
- document.addEventListener('DOMContentLoaded', () => {
- const box = document.querySelector('#box');
- box.style.backgroundColor = 'yellow';
- });
- ```
- 4. ```js
- const wrapper = document.querySelector('#wrapper');
- wrapper.innerHTML += '<p>Новая строка</p>';
- ```
- 5. ```js
- const rect = document.querySelector('.rect');
- rect.style.width = '200px';
- rect.style.height = '100px';
- ```
- 6. ```js
- const toggleBtn = document.querySelector('#toggle');
- const panel = document.querySelector('#panel');
- toggleBtn.addEventListener('click', () => {
- panel.style.display = panel.style.display === 'none' ? 'block' : 'none';
- });
- ```
- 7. ```js
- const p = document.querySelector('p');
- p.style.fontSize = '20px';
- ```
- 8. ```js
- const ball = document.querySelector('#ball');
- ball.addEventListener('click', () => {
- ball.style.transform = 'scale(1.2)';
- setTimeout(() => {
- ball.style.transform = 'scale(1)';
- }, 1000);
- });
- ```
- 9. ```js
- const list = document.querySelector('#list');
- list.innerHTML = '<li>Элемент 1</li><li>Элемент 2</li><li>Элемент 3</li>';
- ```
- 10. ```js
- const img = document.createElement('img');
- img.src = 'path/to/image.jpg';
- img.style.width = '150px';
- document.body.appendChild(img);
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement