Why is the "cancel" button not working?

  • 0
    Hello dear colleagues.
    I wanted to create a small website for my brother in two minutes, but I have problems with the clear button.
    Please check what I did wrong here:
    <!DOCTYPE html>
    <html lang="ru">
    	<meta charset="UTF-8">
    	<title>Урок HTML разметки</title>
    	<meta name="description" content="Урок HTML разметки">
    	<meta name="keywords" content="html,Lesson">
    	<link rel="stylesheet" type="text/css" href="css.css">
    <body id="bod">
    	<div class="uzant_kto">
    		<div class="uznat">
    			<p id="wname">Введи имя человека:</p>
    			<input type="text" id="polevvoda"><br>
    			<input id="submit" type="button" value="Потвердить" onClick="javascript:kto();">
    			<button onСlick="javascript:clear();">Очистить</button>
    			<p id="commanp">#:</p>
    	<img src="yenot.jpg" alt="Чистый енот:)))" style="display:none;">	
    	<script type="text/javascript" language="javascript">
    		function clear() {
    			document.getElementById('polevvoda').value = '';
    			document.getElementById('commanp').innerHTML = '#:';
    	<script type="text/javascript" language="javascript">
    		function kto() {
    		var elmik = document.getElementById('polevvoda').value;
    		fariz = document.getElementById('polevvoda').value;
    		body = document.getElementById('bod');
    		com = document.getElementById('commanp');
    		if (fariz == 'Fariz') {
    			bod.style.background= 'silver';
    			com.innerHTML= '#:<br>Возраст: 11лет;<br>Спорчивость:101%;'; 	
    			if (elmik == 'Elmik') {
    				com.innerHTML= '#:<br>Возраст: 12лет;<br>Спорчивость:1%;';
    			else { alert("Такого имени пока что у нас нет!:(");}
    JavaScript Anonymous, Oct 31, 2019

  • 1 Answers
  • 0
    The problem is in the name of the "clear" function as you use it.

    everything new is well forgotten old

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!