elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.
 
Inicio Ayuda Buscar Ingresar Registrarse
28 Mayo 2012, 04:45  


Tema destacado: Suscripción al boletín mensual de elhacker.net

+  Foro de elhacker.net
|-+  Programación
| |-+  Desarrollo Web
| | |-+  PHP
| | | |-+  problema llamar funcion jquery con php
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: problema llamar funcion jquery con php  (Leído 704 veces)
soru13

Desconectado Desconectado

Mensajes: 211



Ver Perfil
problema llamar funcion jquery con php
« en: 22 Enero 2012, 18:51 »

hola, tengo el siguiente código

Código:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>
Jquery Lights Off Experiment
</title>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#the_lights").fadeTo(1, 0);
            $(".turnon").hide();
            $(".turnoff").click(function () {
                $("#the_lights").css({ 'display': 'block' });
                $("#the_lights").fadeTo("slow", 0.8);
                $(".turnon").show();
                $(".turnoff").hide();
            });
            $(".turnon").click(function () {
                $("the_lights").css({ 'display': 'block' });
                $("#the_lights").fadeTo("slow", 0);
                $(".turnoff").show();
                $(".turnon").hide();
            });
        });
    </script>
    <style type="text/css">
        html
        {
            width: 100%;
            height: 100%;
            margin: 0px;
        }
        #the_lights
        {
            background-color: #000;
            height: 100%;
            width: 100%;
            position: absolute;
            top: 0;
            left: 0;
            display: none;
            z-index: 10;
        }
        .standout
        {
            padding: 5px;
            background-color: white;
            position: relative;
            z-index: 20;
            width:640px;
            height:390px;
            margin: 0px auto;
        }
        .button-standout
        {
            background-color: White;
            position: relative;
            z-index: 20;
            margin: 0px auto;
            width: 100px;
            height: 20px;
        }
        button
        {
            width: 100px;
            height: 20px;
        }
    </style>
</head>

<body">
    <div>
        <p>
            The Jquery Lights Off effect. This is especially useful when you are watching a
            video on a website. If you switch off the lights, the surroundings of the video
            will go dark and it will seem like you are watching a movie in a theater.</p>
    </div>
    <div id="a" class="button-standout">
        <button id="turnoff" class="turnoff" name="turnofflights">
            Lights Off</button>

        <button id="turnon" class="turnon" name="turnonlights">
            Lights On</button></div>
    <div id="standout" class="standout" align="center">
       CONTENIDO
    </div>
    <div id="the_lights">
    </div>
</body>

</html>

el caso es que funciona si le doy al botón, pero yo necesito que se ejecute cuando haga un echo en php. Llevo 2 horas mirando en internet y probando, pero no consigo nada, ¿alguien me podria ayudar?. Gracias


En línea
drvy | BSM


Desconectado Desconectado

Mensajes: 1.129


badstupidmonkey


Ver Perfil WWW
Re: problema llamar funcion jquery con php
« Respuesta #1 en: 22 Enero 2012, 19:30 »

Hola,

javascript
Código
function apagarLuz(){
  $("#the_lights").css({ 'display': 'block' });
  $("#the_lights").fadeTo("slow", 0.8);
  $(".turnon").show();
  $(".turnoff").hide();
}
 
function encenderLuz(){
  $("the_lights").css({ 'display': 'block' });
  $("#the_lights").fadeTo("slow", 0);
  $(".turnoff").show();
  $(".turnon").hide();
}

Para llamarlas:

Código
<?php echo '<script>apagarLuz();</script>'; ?>
Código
<?php echo '<script>encenderLuz();</script>'; ?>


Saludos


En línea
soru13

Desconectado Desconectado

Mensajes: 211



Ver Perfil
Re: problema llamar funcion jquery con php
« Respuesta #2 en: 22 Enero 2012, 19:47 »

Gracias hermano, funciona perfectamente.

Un saludo!  ::)
En línea
Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
llamar funcion
Desarrollo Web
aRTeX 5 642 Último mensaje 4 Junio 2005, 01:23
por MinusFour
Llamar a una funcion dentro de una funcion
Java
Kerber0 3 8,788 Último mensaje 22 Noviembre 2008, 04:40
por joseprox
[Python] Problema al llamar funcion
Scripting
monsefoster 2 1,011 Último mensaje 16 Octubre 2011, 04:55
por monsefoster
por qué no me funciona la función load() de jquery-ajax « 1 2 »
Desarrollo Web
jhonatanAsm 15 1,832 Último mensaje 11 Diciembre 2011, 22:33
por DonVidela
[Como] Deshabilitar pagina de fondo, al llamar a pop up flotante con Jquery.
Desarrollo Web
Graphixx 0 79 Último mensaje 27 Abril 2012, 16:03
por Graphixx
Powered by SMF 1.1.16 | SMF © 2006-2008, Simple Machines