 
			
				18/06/2011, 11:46
			
			
			     |  
      |    |    |    Fecha de Ingreso: junio-2011  
						Mensajes: 3
					  Antigüedad: 14 años, 4 meses Puntos: 0     |        |  
  |      Respuesta: variable session en javascript        muchas gracias por responder! 
alexg88 acá te paso de donde lo llamo:   
este es el template,   
<tr bgcolor="CAF3B1" align="center"><th>Id</th><th>Nombre</th><th>Descripción</th><th>Tareas asociadas</th><th>Productos asociados</th></tr> 
        <!-- START BLOCK : fila --> 
        <tr onclick="asignarDatos(id)" id="{id}"> 
            <td id="id.{id}" width="10%">{id}</td> 
        <td id="nom.{id}"  width="35%">{nombre}</td> 
        <td id="desc.{id}"  width="45%"><div>{descripcion}</div></td> 
        <td id="tar.{id}"  width="5%">{tareas}</td> 
	<td id="prod.{id}"  width="5%">{productos}</td>		 
        <!-- END BLOCK : fila -->   
este es el php:   
if ($result){ 
				while ($reg=mysql_fetch_array($result)){ 
					$tpl -> newBlock ("fila"); 
                                        $tpl -> assign ("id", $reg['id_tarea']);   
                                        $tpl -> assign ("nombre", $reg['nombre']); 
					$todoTarea[ $reg['id_tarea']]= array('nom'=>$reg['nombre']); 
                                        $tpl -> assign ("descripcion", $reg['desc']); 
					$tpl -> assign ("tareas", $reg['tiene_tarea']); 
					$tpl -> assign ("productos", $reg['tiene_prod']); 
                                        $todoTarea[ $reg['id_tarea']]= array('nom'=>$reg['nombre'], 
                                                                             'des'=>$reg['desc'], 
                                                                             'tar'=>$reg['tiene_tarea'], 
                                                                             'prod'=>$reg['tiene_prod']); 
				} 
			$tpl -> printToScreen(); 
                        $_SESSION['datostarea']=$todoTarea;   
Esta es la función que esá en el php: 
<script type='text/javascript'>   
function asignarDatos (tr){ 
document.getElementById(tr).style.backgroundColor=  '#dddddd' ; 
var nom = document.getElementById('nombre'); 
   nom.value='".$_SESSION['datostarea']['tr']['nom']."'; 
      var des = document.getElementById('descripcion'); 
      des.value = tr;   
} 
 </script>";   
IsaBelM, quizá es eso pero no termino de entender como lo soluciono, intenté parsearlo a int pero tampoco..... 
Gracias!!           |