elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Recopilación Tutoriales y Manuales Hacking, Seguridad, Privacidad, Hardware, etc


+  Foro de elhacker.net
|-+  Programación
| |-+  Desarrollo Web
| | |-+  PHP (Moderador: #!drvy)
| | | |-+  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 8,674 veces)
soru13

Desconectado Desconectado

Mensajes: 246



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

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
Moderador
***
Desconectado Desconectado

Mensajes: 5.850



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

Hola,

javascript
Código
  1. function apagarLuz(){
  2.   $("#the_lights").css({ 'display': 'block' });
  3.   $("#the_lights").fadeTo("slow", 0.8);
  4.   $(".turnon").show();
  5.   $(".turnoff").hide();
  6. }
  7.  
  8. function encenderLuz(){
  9.   $("the_lights").css({ 'display': 'block' });
  10.   $("#the_lights").fadeTo("slow", 0);
  11.   $(".turnoff").show();
  12.   $(".turnon").hide();
  13. }

Para llamarlas:

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


Saludos


En línea

soru13

Desconectado Desconectado

Mensajes: 246



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

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
[Python] Problema al llamar funcion
Scripting
monsefoster 2 4,222 Último mensaje 16 Octubre 2011, 04:55 am
por monsefoster
[Como] Deshabilitar pagina de fondo, al llamar a pop up flotante con Jquery.
Desarrollo Web
Graphixx 0 3,440 Último mensaje 27 Abril 2012, 16:03 pm
por Graphixx
Problema con php cargado en un div con jquery
PHP
NataliaV 3 2,561 Último mensaje 25 Agosto 2012, 18:53 pm
por NataliaV
Llamar a una funcion Jquery
Desarrollo Web
mapers 8 3,337 Último mensaje 14 Enero 2014, 00:00 am
por engel lex
Llamar funcion de una clase php desde jquery
PHP
Ethgar 2 10,383 Último mensaje 26 Noviembre 2015, 18:04 pm
por #!drvy
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines