Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Document</title>
- <link rel="stylesheet" href="https://bootswatch.com/4/flatly/bootstrap.min.css">
- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
- <!-- задача 1: да се създаде скрипт, чрез който при натискане върху изображение веднъж то се сменя от http://placehold.co/150x150 на http://placehold.co/50x50, а при повторно натискане върху същото избражение, се връща оригиналното http://placehold.co/150x150 -->
- <!-- задача 2: да се създаде скрипт, чрез който при натискане на бутон с id = change се взима съдържанието на текстово поле, което може да е число от 1 до 3 и в съотвествие с въведеното число се добавя клас нов progress-bar-animated на 1 от 3-те прогресиращи ленти div.progress-bar (внимавайте да не сложите класа на родителя progress). Нека скриптът да позволи максимално една единствена да е анимирана, т.е. ще трябва да премахвате класа от предишната след смяна. -->
- <!-- задача 3: да се създаде скрипт, чрез който при натискане на бутони от едно до пет се взима съответната стойност и я добавя към стойноста в полето. -->
- <!-- задача 4: да се създаде скрипт, чрез който при натискане върху бутон се взима неговата СТОЙНОСТ И КЛАС от типа btn-цвят (btn-info, btn-warning, btn-default и т.н.) и се поставя върху бутон с id button-zero. Необходимо е след повторно натискане, на който и да е друг бутон, класът който е бил добавен преди това да се премахне. (в противен случай големия бутон ще получи всички класове един след друг и накрая няма да реагира при смяна на цвета) -->
- <script>
- document.addEventListener("DOMContentLoaded", function(){
- clean(document.body);
- task1();
- task2();
- task3();
- task4();
- });
- const task1 = () => {
- }
- const task2 = () => {
- }
- const task3 = () => {
- }
- const task4 = () => {
- }
- const clean = (node) =>
- {
- for(var n = 0; n < node.childNodes.length; n ++)
- {
- var child = node.childNodes[n];
- if
- (
- child.nodeType === 8
- ||
- (child.nodeType === 3 && !/\S/.test(child.nodeValue))
- )
- {
- node.removeChild(child);
- n --;
- }
- else if(child.nodeType === 1)
- {
- clean(child);
- }
- }
- }
- </script>
- <style>
- input[type=button].cube{
- width:50px;
- height:50px;
- }
- </style>
- </head>
- <body>
- <!-- задача 1 -->
- <div class="container border border-dark py-2">
- <div class="row mb-4">
- <div class="col-lg-2 col-sm-2 col-md-2"><img src="http://placehold.co/150x150" alt=""></div>
- <div class="col-lg-2 col-sm-2 col-md-2"><img src="http://placehold.co/150x150" alt=""></div>
- <div class="col-lg-2 col-sm-2 col-md-2"><img src="http://placehold.co/150x150" alt=""></div>
- </div>
- <div class="row mb-4">
- <div class="col-lg-2 col-sm-2 col-md-2"><img src="http://placehold.co/150x150" alt=""></div>
- <div class="col-lg-2 col-sm-2 col-md-2"><img src="http://placehold.co/150x150" alt=""></div>
- <div class="col-lg-2 col-sm-2 col-md-2"><img src="http://placehold.co/150x150" alt=""></div>
- </div>
- </div>
- </div>
- <!-- задача 1 -->
- <!-- задача 2 -->
- <div class="container border border-dark py-2">
- <div class="progress progress-striped " style="height:20px;">
- <div class="progress-bar progress-bar-striped bg-success " style="width: 100%;"></div>
- </div>
- <div class="progress progress-striped " style="height:20px;">
- <div class="progress-bar progress-bar-striped bg-info " style="width: 60%;"></div>
- </div>
- <div class="progress progress-striped " style="height:20px;">
- <div class="progress-bar progress-bar-striped bg-danger " style="width: 30%;"></div>
- </div>
- <div class="form-group">
- <input type="text" placeholder="въведете число между 1 и 3" class="form-control" id="progress"/>
- <input type="button" class="form-control btn btn-info" value="change" id="change"/>
- </div>
- </div>
- <!-- задача 2 -->
- <!-- задача 3 -->
- <div class="container my-4 border border-dark py-2">
- <div class="form-group">
- <label for="paragraph">Страница</label>
- <input type="text" class="form-control" id="address">
- </div>
- <ul class="pagination mt-2" id='c'>
- <li class="page-item ">
- <a class="page-link bg-info" href="#c">1</a>
- </li>
- <li class="page-item">
- <a class="page-link bg-info" href="#c">2</a>
- </li>
- <li class="page-item">
- <a class="page-link bg-info" href="#c">3</a>
- </li>
- <li class="page-item">
- <a class="page-link bg-info" href="#c">4</a>
- </li>
- <li class="page-item">
- <a class="page-link bg-info" href="#c">5</a>
- </li>
- </ul>
- </div>
- <!-- задача 3 -->
- <!-- задача 4 -->
- <div class="container border border-dark py-2" id="ladder">
- <table style="display:inline-block;vertical-align:top;">
- <tr>
- <td> <input type="button" class="cube form-control btn btn-info" value="1"> </td>
- <td> <input type="button" class="cube form-control btn btn-warning" value="2"> </td>
- <td> <input type="button" class="cube form-control btn btn-light" value="3"> </td>
- </tr>
- <tr>
- <td> <input type="button" class="cube form-control btn btn-danger" value="4"> </td>
- <td> <input type="button" class="cube form-control btn btn-success" value="5"> </td>
- <td> <input type="button" class="cube form-control btn btn-link" value="6"> </td>
- </tr>
- <tr>
- <td> <input type="button" class="cube form-control btn btn-secondary" value="7"> </td>
- <td> <input type="button" class="cube form-control btn btn-dark" value="8"> </td>
- <td> <input type="button" class="cube form-control btn btn-primary" value="9"> </td>
- </tr>
- </table>
- <span class="d-inline-block">
- <input type="submit" class="form-control" id="button-zero" style="display:inline-block;width:150px;height:150px;font-size:50px;" value="0">
- </span>
- </div>
- <!-- задача 4 -->
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement