Ver Mensaje Individual
  #2 (permalink)  
Antiguo 04/02/2013, 22:42
Avatar de emprear
emprear
Colaborador
 
Fecha de Ingreso: junio-2007
Ubicación: me mudé
Mensajes: 8.388
Antigüedad: 16 años, 11 meses
Puntos: 1567
Respuesta: duda con php y javascript

Varios errores

la estructura if else no es correcta,
if(condicion..){
// hago esto
}esle{ //si no
// hago esto otro
}

estás haciendo una comparación por lo que debes de usar ==
type == 'ROOT'
si no estás simplemente asignando
type = 'ROOT'

Para finalizar no veo el objeto del parámetro username

Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <title>titulo</title>
  5. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  6. <script type="text/javascript">
  7. //<![CDATA[
  8. function save_reseller(username){
  9. var type = 'aaa'; // <?php echo $type....
  10. if( type == 'ROOT') {
  11. alert('Eres el Administrador');
  12. }else{
  13. alert('No eres el Administrador');
  14. }
  15. }
  16. //]]>
  17. </head>
  18. <button onclick="save_reseller();">x</button>
  19. </body>
  20. </html>

Saludos
__________________
La voz de las antenas va, sustituyendo a Dios.
Cuando finalice la mutación, nueva edad media habrá
S.R.