Вопрос

The following produces no visible input text field. What gives?

<!DOCTYPE html>
<head>
</head>
<body>
<script>
var my_input = document.createElement('INPUT');
my_input.type="text; 
my_input.value = "blah";
document.body.appendChild(my_input);
</script>
</body>
</html>
Это было полезно?

Решение

You have a syntax error in your code

my_input.type="text; 

should be

my_input.type="text"; 

Другие советы

Check this out

Easy way

document.write("<input type=\"text\"...blah blah...></input>");

Or correct your error

my_input.type="text; 

to

my_input.type="text"; 

Note: Change the ...blah blah...

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top