så ser min kod ut men ja får det inte till att funka... <codejs>Ladda ny select
<codejs>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
function klick();
{
while( document.forms.f.s1.options.length!=0) {
document.forms.f.s1.options[0] = null
}
if (document.f.s2.value=="Skåne")
{
var new_option = document.createElement("OPTION")
document.forms.f.s1.options.add(new_option)
new_option.text = "Malmö"; new_option.value = "Malmö"
var new_option = document.createElement("OPTION")
document.forms.f.s1.options.add(new_option)
new_option.text = "Helsingborg"; new_option.value = "Helsingborg"
}
</script>
</head>
<body bgcolor="#FFFFFF" onclick="klick()" text="#000000">
<form name="f" method="post" action="">
<select name="s2">
<option value="Alla" selected>Alla</option>
<option value="Skane" onclick="klick()">Skåne</option>
</select>
<br>
<select name="s1">
</select>
</form>
</body>
</html>
</code>Sv: Ladda ny select
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
function klick()
{
while( document.forms.f.s1.options.length!=0) {
document.forms.f.s1.options[0] = null
}
if (document.f.s2.value=="Skane") {
var new_option = document.createElement("OPTION");
document.forms.f.s1.options.add(new_option);
new_option.text = "Malmö"; new_option.value = "Malmö";
var new_option = document.createElement("OPTION");
document.forms.f.s1.options.add(new_option);
new_option.text = "Helsingborg"; new_option.value = "Helsingborg";
}
}
</script>
</head>
<body bgcolor="#FFFFFF" onclick="klick()" text="#000000">
<form name="f" method="post" action="">
<select name="s2">
<option value="Alla" selected>Alla</option>
<option value="Skane" onclick="klick()">Skåne</option>
</select>
<br>
<select name="s1">
</select>
</form>
</body>
</html>
</code>