Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <!DOCTYPE html>
<html lang="ru">
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="./HW9(2)JS.css">
    <h1>Угадай значение!</h1>
    <p>Введите значение от 1 до 100</p>
    <input type="text" placeholder="1...100" maxlength="3">
    <button id="input_Button">Ввести</button>
    <div class="div"></div>       

    <script src="./HW9(2).js"></script>


                body {
    display: flex;
    flex-direction: column;
    align-content: stretch;
    justify-content: space-evenly;
    align-items: center;
    background-color: gainsboro;

H1 {
    text-align: center;
    color: red

p {
    text-align: center;
    font-size: 18px;

div {
    width: 300px;
    height: auto;
    box-shadow: 2px 3px 5px black;
    padding: 24px;
    text-align: center;
    font-size: 30px;
    line-height: 31px;
    box-sizing: border-box;
    position: absolute;
    top: 140px;
    visibility: hidden; 

input {
    font-size: 16px;

    font-size: 16px;
    margin-top: 15px;

.close_Button {
    width: 90px;
    height: 30px;
    background-color: lightgray;
    border-radius: 10px;
    display: block;
    margin: 16px auto 0px;
    cursor: pointer;



                const get = elem => document.querySelector(elem);

let input = get("input");

let inputButton = get("#input_Button");

let rand = Math.round(Math.random()*100);

const div = get("div");

const buttonClose = document.createElement("button");

inputButton.onclick = () => {
    let value = input.value;
    let d = parseInt(value);
    if (d > 0 && d < 100){
     else {
        showDiv(`Вы ввели неверное значение!${"<br/>"}Введите число от 1 до 100`, "rgb(238, 82, 82)");

const showMessage = (digit) => {
    if (digit == rand) {
        showDiv(`Поздравляем,${"<br/>"}Вы угадали!`, "rgb(0, 255, 64)");
    } else {
        if (digit < rand) {
            showDiv(`Загаданное значение больше введенного вами`, "rgb(148, 147, 147)");
        } else {
            showDiv(`Загаданное значение меньше введенного вами`, "rgb(148, 147, 147)");

const showDiv = (text, backgroundColor) =>{
    div.innerHTML = text; = backgroundColor; = "visible";

const addButtonClose = () => {
    buttonClose.innerHTML = "Закрыть";

buttonClose.onclick =() => { = "hidden";