Ver Mensaje Individual
  #14 (permalink)  
Antiguo 15/02/2013, 15:22
Avatar de satjaen
satjaen
 
Fecha de Ingreso: septiembre-2012
Ubicación: Jaén (Andalucía)
Mensajes: 893
Antigüedad: 11 años, 8 meses
Puntos: 10
Respuesta: Dar estilo a un array.

Una pregunta, donde tengo que poner el campo style en el html o en el ajax?.

ajax.php
Código PHP:
Ver original
  1. $datos[] = array(
  2.             'id_aviso'          => $row['id_aviso'],
  3.             'telefonos'          => $row['telefonos'],
  4.             'name'      => $row['name'],
  5.             'apellidos'       => $row['apellidos'],
  6.             'localidad'        => $row['localidad'],
  7.             'style'            => 'background-color:red;'
  8.         );

index.html
Código HTML:
Ver original
  1. <div id="usuario">
  2.             <table width="100%" id="data" class="table-dg-grid" >
  3.              <thead>
  4.               <tr>
  5.               <th><div id="carga1" class="carga1"></div></th>
  6.        <tr bgcolor=#DFEBFF id=t70 ondblclick='coloreaf(70,1)' onMouseOver='coloreamosin(70,1)' onMouseOut='coloreamosout(70,1)'>
  7.                      <th><span title="selecc">Selecc.</span></th>
  8.                     <th><span title="id_aviso">Nº Aviso</span></th>
  9.                     <th><span title="telefonos">Teléfono</span></th>
  10.                     <th><span title="name">Nombre</span></th>
  11.                     <th><span title="poblacion">Población</span></th>
  12.                      </tr>
  13.                 </thead>
  14.                 <tbody>
  15.                 </tbody>                  
  16.             </table>
  17.                 </div>

js.js

Código Javascript:
Ver original
  1. html_user += '<tr ondblclick="pulsar(this, ' + *String.fromCharCode(39) + item.id_aviso + String.fromCharCode(39) *+ ');" >';
  2. html_user += '<td ><input name="demo" type="radio" value="' + item.id_aviso + '"/></td>';
  3. html_user += '<td>'+item.id_aviso+'</td>';
  4. html_user += '<td>'+item.telefonos+'</td>';
  5. html_user += '<td>'+item.name+' '+item.apellidos+'</td>';
  6. html_user += '<td>'+item.localidad+'</td>';
  7. html_user += '</tr>';