Ver Mensaje Individual
  #3 (permalink)  
Antiguo 15/04/2009, 14:10
machoman112233
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: DOM Firefox, IE, Chrome, etc...

Tengo por ejemplo este codigo... se supone que al cambiar una opcion del <select> me cambia el texto que hay en un <textarea>... Solo funcion con Firefox, para los demas nada... solo quiero saber, que hago mal para que solo me funcione con Firefox...

Código javascript:
Ver original
  1. <div class="box">
  2.                 <fieldset>
  3.                     <legend><?php echo $lang['QUESTION_LEGEND_UPDATE']; ?></legend>
  4.                     <?php
  5.                     $sql = 'SELECT * FROM ' .$prefix. 'preguntes ORDER BY `id_pregunta` DESC;';
  6.                     $query = $mysql_con->Consulta($sql);
  7.                     if($mysql_con->NumFilas() == 0)
  8.                     {
  9.                         echo '<b>' .$lang['QUERY_ZERO']. '</b>';
  10.                     }
  11.                     else
  12.                     {
  13.                     ?>
  14.                         <script type="text/javascript">
  15.                             var n = new Array();
  16.                             var s = new Array();
  17.                             var ind = 0;
  18.                         </script>
  19.                         <?php
  20.                         while($data = $mysql_con->VerDatos($query))
  21.                         {
  22.                         ?>
  23.                             <script type="text/javascript">;               
  24.                                 n["<?PHP echo $data->sid_pregunta; ?>"] = "<?PHP echo str_replace("\r\n","\\n",$data->pregunta);?>";
  25.                                 s[ind] = "<?PHP echo $data->sid_pregunta; ?>";
  26.                                 ind++;
  27.                             </script>
  28.                         <?php
  29.                         }
  30.                         ?>
  31.                         <script type="text/javascript"><!--//--><![CDATA[//><!--
  32.                         function show_select()
  33.                         {
  34.                             var i = 0;
  35.                             var se = document.getElementById("select");
  36.                             for(i = 0; i < s.length; i++)
  37.                             {
  38.                                 var o = document.createElement("option");
  39.                                 var t = document.createTextNode(n[s[i]].substr(0,50)+"...");
  40.                                        
  41.                                 o.setAttribute("onclick","(show_preg('"+s[i]+"'));");
  42.                                 o.appendChild(t);
  43.                                 se.appendChild(o);
  44.                             }
  45.                             show_preg(s[0]);
  46.                         }
  47.                        
  48.                         function show_preg(id)
  49.                         {
  50.                             document.getElementById("preg_name").value = n[id];
  51.                             document.getElementById("preg_s").value = id;
  52.                         }              
  53.                         //--><!]]></script>
  54.                            
  55.                         <form action="<?php echo $root_path. 'functions/ctrlmysql.' .$phpEx; ?>" method="get" onsubmit="return(true);">
  56.                             <select id="select"><!--<option></option>--></select><br />
  57.                             <textarea id="preg_name" name="new_question" rows="5" cols="50"></textarea>
  58.                             <input type="hidden" name="preg_s" id="preg_s" value=""/><br />
  59.                             <input type="hidden" name="table" value="<?php echo 'preguntes'; ?>" />
  60.                             <input type="hidden" name="uri" value="<?php echo $_SERVER['REQUEST_URI']; ?>" />
  61.                             <input type="submit" name="do" value="<?php echo $lang['UPDATE'] ?>"/>
  62.                             <input type="submit" name="do" value="<?php echo $lang['DELETE'] ?>"/>
  63.                         </form>
  64.                         <?php
  65.                     }
  66.                     echo $mysql_con->VerError();
  67.                     ?>
  68.                 </fieldset>
  69.             </div>