Foros del Web » Programando para Internet » Javascript »

Como hago?

Estas en el tema de Como hago? en el foro de Javascript en Foros del Web. SALUDOS A TODOS.. ME GUSTARIA SABER COMO HAGO PARA Q AL SELECCIONAR UNA OPCION DE LA PARTE REVISTAS ME APARESCA LA IMAGEN DE LA REVISTA ...
  #1 (permalink)  
Antiguo 08/11/2012, 07:07
 
Fecha de Ingreso: noviembre-2012
Ubicación: JUJUY
Mensajes: 10
Antigüedad: 11 años, 5 meses
Puntos: 0
Pregunta Como hago?

SALUDOS A TODOS.. ME GUSTARIA SABER COMO HAGO PARA Q AL SELECCIONAR UNA OPCION DE LA PARTE REVISTAS ME APARESCA LA IMAGEN DE LA REVISTA COMO SE VE EN LA SIGUIENTE IMAGEN..
DESDE YA GRACIAS A LOS Q ME PUEDAN AYUDAR CON ESTO
  #2 (permalink)  
Antiguo 08/11/2012, 07:14
Avatar de abimaelrc
Colaborador
 
Fecha de Ingreso: mayo-2009
Ubicación: En el planeta de Puerto Rico
Mensajes: 14.734
Antigüedad: 15 años
Puntos: 1517
Respuesta: Como hago?

Busca por thumbs en PHP en internet.
__________________
Verifica antes de preguntar.
Los verdaderos amigos se hieren con la verdad, para no perderlos con la mentira. - Eugenio Maria de Hostos
  #3 (permalink)  
Antiguo 08/11/2012, 08:19
 
Fecha de Ingreso: noviembre-2012
Ubicación: JUJUY
Mensajes: 10
Antigüedad: 11 años, 5 meses
Puntos: 0
Respuesta: Como hago?

lo q yo nesito es q al marcar una opcion me aparesca la imagen y q al no tener seleccionado ninguna opcion no aparesca ninguna imagen
  #4 (permalink)  
Antiguo 08/11/2012, 08:24
Avatar de andreamorante184  
Fecha de Ingreso: agosto-2012
Mensajes: 65
Antigüedad: 11 años, 8 meses
Puntos: 0
Respuesta: Como hago?

con un ajax
__________________
Andrea Morante
  #5 (permalink)  
Antiguo 08/11/2012, 08:34
Avatar de abimaelrc
Colaborador
 
Fecha de Ingreso: mayo-2009
Ubicación: En el planeta de Puerto Rico
Mensajes: 14.734
Antigüedad: 15 años
Puntos: 1517
Respuesta: Como hago?

Ese problema es de javascript no de PHP. Pero es sencillo solo es cuestión de manejar el display y con javascript cambias el display.
__________________
Verifica antes de preguntar.
Los verdaderos amigos se hieren con la verdad, para no perderlos con la mentira. - Eugenio Maria de Hostos
  #6 (permalink)  
Antiguo 11/11/2012, 09:37
 
Fecha de Ingreso: noviembre-2012
Ubicación: JUJUY
Mensajes: 10
Antigüedad: 11 años, 5 meses
Puntos: 0
Respuesta: Como hago?

me podrias mostrar un ejemplo de lo q dicen xq soy nuevo respecto a la programacion..
  #7 (permalink)  
Antiguo 11/11/2012, 12:21
 
Fecha de Ingreso: mayo-2011
Mensajes: 105
Antigüedad: 13 años
Puntos: 3
Respuesta: Como hago?

crea una funcion que reciba el id del radio button y si las imagenes de las revistas no las llamas de la base de datos ps simplemente tienes un arreglo de las url de las imagenes y vas llamando a cada src segun corresponda:

En el html:
Código HTML:
Ver original
  1. <div id='gruporadiobuttons'>
  2. <input type='radio' id='0' onclick='CargarImagenRevista($(this).attr("id"),"lienzorevistas");'/>
  3. <input type='radio' id='1' onclick='CargarImagenRevista($(this).attr("id"),"lienzorevistas");'/>
  4. <input type='radio' id='2' onclick='CargarImagenRevista($(this).attr("id"),"lienzorevistas");'/>
  5. </div>
  6. <!--aqui el lienzo de la imagen-->
  7. <div id='lienzorevistas' style='float:left; margin-left:1em; width:420px; height:300px;'>
  8. </div>

En el script js

Código Javascript:
Ver original
  1. //declaras un array global que almacene las rutas de las imagenes
  2.  
  3. var seturlimagenes = new Array();
  4.  
  5. //ejemplo con 3 imagenes:
  6.  
  7. seturlimagenes[0] = "url1delarevista1";
  8. seturlimagenes[1] = "url1delarevista1";
  9. seturlimagenes[2] = "url1delarevista1";
  10.  
  11. //funcion que recibe el id del radio button y el id del lienzo donde se va a pintar la imagen
  12.  
  13. function CargarImagenRevista(idradiobutton,idcanvas){
  14. //esta linea es con jquery
  15. //como la imagen la estamos cargando en el lienzo mediante la propiedad background, el //lienzo debe tener dimensiones ancho alto predefinidas
  16. $('#'+idcanvas).css({backgroundImage:'url('+seturlimagenes[idradiobutton]+')'})
  17. }

hay muchas maneras de hacerlo pero esta es al forma inmediata que se me ocurrio
Espero te sirva
  #8 (permalink)  
Antiguo 11/11/2012, 18:07
 
Fecha de Ingreso: noviembre-2012
Ubicación: JUJUY
Mensajes: 10
Antigüedad: 11 años, 5 meses
Puntos: 0
Respuesta: Como hago?

HASTA EL MOMENTO LO Q TENGO ES ESTO PERO NOSE COMO INTRODUCIR LO Q ME DIJISTE EN MI ARCHIVO, COMO VERAN TENGO SELECCIONADO 2 REVISTAS PERO ME SIGUE MOSTRANDO LAS 3 ..


ACA TE DEJO EL CODIGO DE MI ARCHIVO
Código PHP:
<?php
include("conexion.php");
//Sistema de registro --HiperAcme.net--

if(isset($_POST['registro']))//Vallidamos que el formulario fue enviado
{
    
/*Validamos que todos los campos esten llenos correctamente*/
    
if(($_POST['nick'] != '') && ($_POST['apellido'] != '') && ($_POST['mail'] != '') && ($_POST['empresa'] != ''))
    {
        if(
$_POST['pass'])
        {
            echo 
'<br />Las contrase&ntilde;as no coinciden';
        }
        else
        {
            
            
$nicklimpiar($_POST['nick']);
            
$apellidolimpiar($_POST['apellido']);
            
$maillimpiar($_POST['mail']);
            
$empresalimpiar($_POST['empresa']);
            
            
            
            
$b_usermysql_query("SELECT nick FROM usuarios WHERE nick='$nick'");
            if(
$user=@mysql_fetch_array($b_user))
            {
                echo 
'<br />El nombre de usuario o el email ya esta registrado.';
                
mysql_free_result($b_user); //liberamos la memoria del query a la db
            
}
            else
            {
                if(
validar_email($_POST['mail']))
                {
                    
mysql_query("INSERT INTO usuarios (nick,apellido,mail,empresa) values ('$nick','$apellido','$mail','$empresa')");
                    echo 
'<br />Te has registrado Correctamente, ahora podras iniciar sesi&oacute;n como usuario registrado.';
                }
                else 
                {
                    echo 
'<br />El email no es valido.';
                }
            }
        }
    }
    else
    {
        echo 
'<br />Deberas llenar todos los campos.';
    }
}


?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
        <title>Captcha - PHP | Jquery Easy</title>
        <style type="text/css">
            #form{
                margin:100px;
                width: 350px;
                outline: 5px solid #4A3C31;
                border: 1px solid #4A3C31;
                padding: 10px;
                margin:0 auto;
            }
            #form label{
                font:bold 11px arial;
                color: #565656;
                padding-left: 1px;
            }
            #form label.mandat{color: #f00;}
            #form input[type="text"]{
                height: 30px;
                margin-bottom: 8px;
                padding: 5px;
                font: 12px arial;
                color: #0060a3;
            }
            #form textarea{
                width: 340px;
                height: 80px;
                resize: none;
                margin: 0 0 8px 1px;
                padding: 5px;
                font: 12px arial;
                color: #4A3C31;
            }
            #form img{
                margin-bottom: 8px;
            }
            #form input[type="submit"]{
                background-color: #0064aa;
                border: none;
                color: #fff;
                padding: 5px 8px;
                cursor: pointer;
                font:bold 12px arial;
            }
            .error{
                text-align:center;
                background:#B7F9AC;
                color:#C33;
            }
            .cap_status{
                width: 350px;
                padding: 10px;
                font: 14px arial;
                color: #fff;
                background-color: #10853f;
                display: none;
            }
            .cap_status_error{
                background-color: #bd0808;                
            }
           .cabecera{
                background: #4A3C31;
                border-bottom: 5px solid #69AD3C;
                margin:-8px 0 0 -8px;
                width: 100%;
            }
           .cabecera img{ 
                margin:40px 0 0 30px;
            }

</style>
</head>

<body>
<div class="cabecera"><br/></div>

    
    
    <div style='margin:0 auto'>
    <h4></h4>
    
        <form action="registro.php" method="post">
            <div id="form">
                <table border="0" width="100%">
                    <tr>
                        <td colspan="2"><label>Nombres:</label><label class="mandat"> *</label><br/>
                            <input type="text" name="nick"</td>
                    </tr>
                    <tr>
                        <td colspan="2"><label>Apellido:</label><label class="mandat"> *</label><br/>
                            <input type="text" name="apellido"</td>
                    </tr>
                    <tr>
                        <td colspan="2"><label>Email:</label><label class="mandat"> *</label><br/>
                            <input type="text" name="mail"</td>
                    </tr>                    
                    <tr>
                        <td colspan="2"><label>Verificar</label><label class="mandat"> *</label></td>
                    </tr>
                    <tr>
                        <td width="60px">                           
                            <input type="text" name="captcha" id="captcha" maxlength="6" size="6"/></td>
                        <td><img src="captcha.php"/></td>
                    </tr>
                    <tr>
                        <td colspan="2"><label>Empresa:</label><label class="mandat"> *</label><br/>
                            <input type="text" name="empresa"</td>
                    </tr>
                      <tr>
                        <td colspan="3"><label>Revistas:</label>
                          <label class="mandat"></label>
                          <p>
                            <input type="checkbox" name="transporte" value="1" />
                            SHAMAN KING <br />
                            <input type="checkbox" name="transporte2" value="2" />
                            DRAGON BALL <br />
                            <input type="checkbox" name="transporte2" value="3" />
                            SLAM DUNK </p></td>
                    </tr>

<table width="295" border="1" align="center" bordercolor="#FFFFFF"><!--DWLayoutTable-->
  <tr>
    <td width="91" height="135" bordercolor="#FFFFFF"><div align="center"><img src="imagenes/Shaman.jpg" width="91" height="127" /></div></td>
    <td width="91" bordercolor="#FFFFFF"><div align="center"><img src="imagenes/lazer59.jpg" width="91" height="127" /></div></td>
    <td width="91"><div align="center"><img src="imagenes/lazer-23-ivrea_MLA-O-109120944_7370.jpg" width="91" height="127" /></div></td>
  </tr>
</table>

<BR>

                        
                    <tr>
                        <td><input type="submit" name="registro" style="width:100px;" tabindex="6" value="ENVIAR" /></td>
                        <td><input type="reset" name="Limpiar" style="width:100px;" tabindex="6" value="BORRAR" /></td>
                        <br>                                
                        <td><a href="login.php">Identificarse</a></td>
                        <td></td>
                    </tr>
                </table>
                
            </div>
        </form>
        </div>

</div>    
</body>
</html>
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 23:29.