<script language=JavaScript>
<!-- Begin
oldvalue = "";
function passText(passedvalue) {
if (passedvalue != "") {
var totalvalue = passedvalue+"\n"+oldvalue;
document.form.zona.value = totalvalue;
oldvalue = document.form.zona.value;
}
}
function passText2(passedvalue) {
if (passedvalue != "") {
var totalvalue = passedvalue+"\n"+oldvalue;
document.form.cimas.value = totalvalue;
oldvalue = document.form.cimas.value;
}
}
// End -->
</SCRIPT>
<script language="javascript">
<?php
$sql = "SELECT ZonaN, Cima, ZonaNombre FROM trackcatalogo ";
$result = $db->sql_query($sql);
?>
// FUNCION DE COMBO BOX COMBINADO
function sublist(form, selecteditem)
{
form.cimas1.length = 0
<?php
$count= 0;
$y=0;
while ($row = $db->sql_fetchrow($result))
{
?>
x = <?=trim($y);?>;
prov = new Array();
cimas_desc = "<?=$row['Cima']; ?>";
cimas_cod_index = "<?=$row['ZonaN']; ?>";
cimas_cod = "<?=$row['Cima']; ?>";
prov[x,0] = cimas_desc;
prov[x,1] = cimas_cod_index;
prov[x,2] = cimas_cod;
if (prov[x,1] == selecteditem) {
var option<?=trim($count); ?> = new Option(prov[x,0], prov[x,2]);
form.cimas1.options[form.cimas1.length]=option<?=trim($count)?>;
}
<?php
$count = $count + 1;
$y = $y + 1;
}
?>
if (selecteditem == 'Otras') {
newZona = "";
while (newZona == ""){
newZona=prompt ("Por favor indica el nombre de la zona.", "");
}
if (newZona != null) {
passText(newZona)
}
}
}
</SCRIPT>
<select class=campo size="1" id="zonas1" name="zonas1" onChange = "javascript:sublist(this.form, zonas1.value);">
<option selected>Selecciona Zona</option>
<option value="Otras">OTRAS ZONAS</option>
<?php
$query2="select ZonaN, ZonaNombre from trackzonas order by ZonaNombre ";
$result2 = $db->sql_query($query2);
while ($raw = $db->sql_fetchrow($result2))
{
?>
<option value="<?=$raw['ZonaN'] ?>"> <?=$raw['ZonaNombre']?></option>
<?php
}
?>
</SELECT>
<br>
<br><FONT face="Arial, Helvetica, Sans Serif" size=2>Zona a añadir:</FONT><BR>
<TEXTAREA class=text name=zona rows=5 cols=20></TEXTAREA> <br>
<SELECT class=campo id="cimas1" name="cimas1" size="1" >
<Option value="vacio">Cumbres de la Zona</option>
<option value="otras">OTRAS CIMAS</option>
</SELECT><br>
<INPUT class=boton onclick=passText2(this.form.cimas1.options[this.form.cimas1.selectedIndex].value); type=button value="Añadir a la lista">
<TEXTAREA class=text name=cimas rows=5 cols=20></TEXTAREA> <br>