Forum Moderators: open
This is how the function looks now:
<script language="JavaScript" type="text/javascript">
<!--
var newGenre = "";
function genreAdd()
{
newGenre+='<select name="genre[]" size="1" class="menu">';
newGenre+='<option value="" selected>select</option>';
newGenre+='<option value="action">action</option>';
newGenre+='<option value="adventure">adventure</option>';
newGenre+='<option value="animation">animation</option>';
newGenre+='<option value="cartoon">cartoon</option>';
newGenre+='<option value="comedy">comedy</option>';
newGenre+='<option value="crime">crime</option>';
newGenre+='<option value="documentary">documentary</option>';
newGenre+='<option value="drama">drama</option>';
newGenre+='<option value="erotica">erotica</option>';
newGenre+='<option value="family">family</option>';
newGenre+='<option value="fantasy">fantasy</option>';
newGenre+='<option value="horror">horror</option>';
newGenre+='<option value="martial-arts">martial-arts</option>';
newGenre+='<option value="music">music</option>';
newGenre+='<option value="musical">musical</option>';
newGenre+='<option value="mystery">mystery</option>';
newGenre+='<option value="romance">romance</option>';
newGenre+='<option value="science-fiction">science-fiction</option>';
newGenre+='<option value="theathre">theathre</option>';
newGenre+='<option value="thriller">thriller</option>';
newGenre+='<option value="tv-series">tv-series</option>';
newGenre+='<option value="war">war</option>';
newGenre+='</select><br/>';
document.getElementById('genre_container').innerHTML = newGenre;
}
-->
</script>
basically a function like genreRemove() should remove the exact same menu, but I think there will be problems determining which one to remove to begin with, as I use html textfield arrays (name="form_field[]") to process the results on submission
javascript guru's, let the thinking begin! :D
Do you want to remove the last added select element?
var genreSelects = document.getElementsByName('genre[]');
document.getElementById('genre_container').removeChild(
genreSelects[genreSelects.length-1]
);
Wouldn't it be easier to use a single select element with the
multiple attribute?