Ver Mensaje Individual
  #3 (permalink)  
Antiguo 09/05/2011, 15:52
alexg88
 
Fecha de Ingreso: abril-2011
Mensajes: 1.342
Antigüedad: 13 años
Puntos: 344
Respuesta: Problema con javascript en php

El código si funciona. El problema está en el echo.
Pon las comillas de fuera como dobles y las de dentro escapalas con \.

Código PHP:
Ver original
  1. <?php
  2. <?php
  3. include("conexion.php");
  4. ' . $_SESSION['usuario'] . ' #No entiendo que quieres hacer con esto
  5. user_login();
  6.  
  7. <?php
  8.  
  9. echo '<meta http-equiv="Refresh" content="5;url=perfil.php"> ';
  10. echo "<html>
  11. <head>
  12. <style type=\"text/css\">/*Container*/  
  13.    .progress-bar {  
  14.        border: 1px solid #56577A;  
  15.  
  16.        width: 200px;  
  17.        margin: 5px;  
  18.        padding: 1px;  
  19.        background: #fff;  
  20.        float: left;  
  21.  -moz-border-radius:5px 5px 5px 5px;
  22.  -ms-border-radius: 5px 5px 5px 5px;
  23.  -webkit-border-radius: 5px 5px 5px 5px;
  24.  border-radius: 5px 5px 5px 5px;
  25.    }  
  26.      
  27.  
  28.    .bar {  
  29.        height: 15px;  
  30.        font-size: 11px;  
  31.        
  32.        text-indent:-9000px;  
  33.  
  34.  -moz-border-radius:5px 5px 5px 5px;
  35.  -ms-border-radius: 5px 5px 5px 5px;
  36.  -webkit-border-radius: 5px 5px 5px 5px;
  37.  border-radius: 5px 5px 5px 5px;
  38.  
  39.    }  
  40. </style>
  41.      
  42.    <script type=\"text/javascript\">  
  43.        window.onload = function() {initialize()}  
  44.  
  45. function initialize() {  
  46.        divId = \"sample\";  
  47.        thedivId = document.getElementById(divId);  
  48.        var percentage = thedivId.innerHTML;  
  49.  
  50.        thedivId.style.backgroundColor=\"#000\";  
  51.        brim(divId,0,parseInt(percentage.substr(0, percentage.length-1)));  
  52.    }  
  53.    function brim(Id,start,percentage) {  
  54.        if (document.getElementById) {  
  55.             o = document.getElementById(Id);  
  56.                 if (start <= percentage) {  
  57.                    setWidth(o, start);  
  58.                    start += 1;  
  59.                    //Show progression percentage near the progress bar  
  60.                    document.getElementById(\"percentage\").innerHTML = (start -1) + \"%\";  
  61.                    window.setTimeout(\"brim('\"+Id+\"',\"+start+\",\"+percentage+\")\", 50);  
  62.                 }  
  63.       }  
  64.    }  
  65.      
  66.    function setWidth(o, start) {  
  67.        o.style.width = start+\"%\";  
  68.    }  
  69.    </script>      
  70. </head>
  71. <body>
  72. <div class=\"progress-bar\" >  
  73.        <div id =\"sample\" class=\"bar\">100%</div>  
  74.    </div>  
  75.    <div id =\"percentage\"></div>  
  76. </body>
  77. </head>";
  78.  
  79.  
  80.  
  81. ?>