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">
    <head>
    	<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">
    </head>
    <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>
    		</div>
    
    	</div>
    	
    	<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>
    
    	<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%;'; 	
    		}
    
    		else{
    			if (elmik == 'Elmik') {
    
    				com.innerHTML= '#:<br>Возраст: 12лет;<br>Спорчивость:1%;';
    		}	
    			else { alert("Такого имени пока что у нас нет!:(");}
    		}}
    
    	</script>
    
    
    </body>
    </html>
    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
    Anonymous

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