
Alguno sabe por que no funciona plis
Publicado por Sergio (19 intervenciones) el 22/05/2014 14:29:57
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<!DOCTIPE html>
<html lang="es">
<head>
</head>
<body>
<form>
<select id="mySelect" size="8">
<option>Apple</option>
<option>Pear</option>
<option>Banana</option>
<option>Orange</option>
</select>
</form>
<br>
<p>Click the button to add a "Kiwi" option at the end of the dropdown list.</p>
<input type="text" name="customMediaURL" value="" size="70" id="customMediaURL">
<button type="button" onclick="myFunction()">Insert option</button>
<script>
function myFunction()
{
var x = document.getElementById("mySelect");
var option = document.createElement("option");
option.text = document.getElementById("customMediaURL").text;
x.add(option);
}
</script>
</body>
</html>
añade pero sale, undefined.
Valora esta pregunta


0