Код:
<input type = "text" name = "Name" id = "name" placeholder = "Name">
<input type = "text" name = "Surname" id = "sur" placeholder = "Surname">
<input type = "text" name = "Age" id = "age" placeholder = "Age">
<p id = b></p>
<button type = "button" onclick = "onClick()">Get information</button>
<script>
var fullName;
function onClick() {
fullName += "Your name is " + name + " " + sur + " and you are " + age + " years old.";
document.getElementById('b').innerHTML = fullName;
}
</script>
При выполнение кода выползает такое окно:
Нужно, чтобы вывело:
Цитата:
|
Your name is Karina Romanovska and you are 14 years old.
|
Подправьте, пожалуйста, код.