1
Aprender a programar desde cero / Re:Javascript-Texto flotante siempre en pantalla
« en: 26 de Mayo 2017, 10:31 »
Muchas gracias

Aprende a programar desde cero con el libro "Aprender a programar. Algoritmos y fundamentos de programación orientados a la ingeniería y ciencias". 748 pgs. Editorial aprenderaprogramar.com.
Esta sección te permite ver todos los posts escritos por este usuario. Ten en cuenta que sólo puedes ver los posts escritos en zonas a las que tienes acceso en este momento.
numero_preg smallint(5) UNSIGNED Nulo:No Predeterminado:Ninguna AUTO_INCREMENT
correcta tinyint(3) UNSIGNED Nulo:Sí Predeterminado:NULL
El campo correcta lo inicializo (las 80 filas de esa tabla) a 255, valor que indicará que no se ha contestado aún.$valor_correcta=1;
mysqli_query($conexion, "update $tabla3 set correcta='1' where numero_preg='$numero_pregunta'"
o
mysqli_query($conexion, "update $tabla3 set correcta='$valor_correcta' where numero_preg='$numero_pregunta'"
o
mysqli_query($conexion, "update $tabla3 set correcta='".$valor_correcta."' where numero_preg='$numero_pregunta'"
o
mysqli_query($conexion, "update $tabla3 set correcta="1" where numero_preg='$numero_pregunta'"
echo "Grabando como correcta pregunta " . $numero_pregunta . " en la tabla: " . $tabla3;
<html>
<head>
<title>Lineas con hr</title>
</head>
<body>
<hr style="height:10px; color: black; width: 100px">
<hr style="height:10px; color: black; background-color: green; width: 100"/>
<hr style="height:10px; color: black; background-color: red; width: 100px">
</body>
</html>
<html>
<head>
<title>Crear Tabla</title>
</head>
<body>
<?php
//Prueba de creaccion de tablas en la base de datos preguntas
$conexion=mysqli_connect("localhost","root","","respuestas") or
die("Problemas con la conexión");
$crear="CREATE TABLE nomenclatura ( numero_preg smallint UNSIGNED , correcta char(1))";
$crear_tabla=mysql_query($crear,$conexion)
or die(mysql_error());
if(!$crear_tabla)
{
echo 'Error al crear la tabla en la base de datos';
}
else
{
echo 'La tabla se creo correctamente';
}
?>
</body>
</html>
CREATE TABLE nomenclatura ( numero_preg smallint UNSIGNED , correcta char(1))
<html>
<head>
<title>Extracion de apellidos</title>
</head>
<body>
<?php
//$apellidos="Gutierrez Ayala";
//$apellidos="Lopez Martin";
$apellidos="Goirigorreketechea Mentxakasubiroguea";
$posicion_espacio=strpos($apellidos, " ");
$longitud=strlen($apellidos);
$apellido1=substr($apellidos,0,$posicion_espacio);
$apellido2=substr($apellidos,$posicion_espacio+1,$longitud-$posicion_espacio);
echo "Longitud de los apellidos : " . $longitud . "<br>";
echo "Posición del espacio : " . $posicion_espacio . "<br>";
echo "Apellido1 : #" . $apellido1 . "#<br>";
echo "Apellido2 : #" . $apellido2 . "#";
?>
</body>
</html>
[code]
El problema son los apellidos compuestos: Lopez de la Huerta Martin de la Fragua ;D
<html>
<head>
<title>Control Radio mejorado</title>
</head>
<body>
<?php
$Respuesta_preseleccionada=1;
?>
<form action="FORMULARIO_control_radio_mejoradob.php" method="post">
<input type="radio" name="radio1" value="linea1" checked=<?php if ($Respuesta_preseleccionada===1) {echo '"checked"'; } else {echo"";} ?> >Linea1 <br>
<input type="radio" name="radio1" value="linea2" checked=<?php if ($Respuesta_preseleccionada===2) {echo '"checked"'; } else {echo"";} ?> >Linea2 <br>
<input type="radio" name="radio1" value="linea3" checked=<?php if ($Respuesta_preseleccionada===3) {echo '"checked"'; } else {echo"";} ?> >Linea3 <br>
<input type="radio" name="radio1" value="linea4" checked=<?php if ($Respuesta_preseleccionada===4) {echo '"checked"'; } else {echo"";} ?> >Linea4 <br>
<br>
<input type="submit" name="Confirmar" value="Enviar Respuesta">
</form>
<?php
echo "Respuesta preseleccionada: " .$Respuesta_preseleccionada;
?>
</body>
</html>
<html>
<head>
<title>Control Radio mejorado</title>
</head>
<body>
<form action="FORMULARIO_control_radio_mejoradob.php" method="post">
<input type="radio" name="radio1" value="linea1" >Linea1 <br>
<input type="radio" name="radio1" value="linea2" >Linea2 <br>
<input type="radio" name="radio1" value="linea3" checked="checked" >Linea3 <br>
<input type="radio" name="radio1" value="linea4">Linea4 <br>
<br>
<input type="submit" name="Confirmar" value="Enviar Respuesta">
</form>
</body>
</html>
<html>
<head>
<title>Control Radio mejorado</title>
</head>
<body>
<?php
$Respuesta_preseleccionada=3;
?>
<form action="FORMULARIO_control_radio_mejoradob.php" method="post">
<input type="radio" name="radio1" value="linea1" >Linea1 <br>
<input type="radio" name="radio1" value="linea2" >Linea2 <br>
<input type="radio" name="radio1" value="linea3" name="linea3"
<?php
if ($Respuesta_preseleccionada==3)
{
checked="checked";
}
?>
> Linea3 <br>
<input type="radio" name="radio1" value="linea4">Linea4 <br>
<br>
<input type="submit" name="Confirmar" value="Enviar Respuesta">
</form>
</body>
</html>
<html>
<head>
<title>Problema</title>
</head>
<body>
<?php
$max=20;
$num_aleatorio = rand(1,$max);
?>
<form action="Paso_parametros_por_hipervinculob.php?numero=$num_aleatorio" method="post">
<input type="submit" name="Confirmar" value="Enviar Respuesta">
</body>
</html>
<html>
<head>
<title>Problema</title>
</head>
<body>
<?php
echo "Numero generado en form previo y recibido: " . $_REQUEST['numero'];
?>
</body>
</html>
<form action="Paso_parametros_por_hipervinculob.php?numero=<?php$num_aleatorio?>" method="post">
<html>
<head>
<title>Control radio mejorado</title>
</head>
<body>
<form action="FORMULARIO_control_radio_mejoradob.php" method="post">
<div onmouseover="this.style.backgroundColor='lightblue'" onmouseout="this.style.backgroundColor=''" >
<input type="radio" name="radio1" value="respuesta1" name="linea1"> Linea1
</div>
<div onmouseover="this.style.backgroundColor='lightblue'" onmouseout="this.style.backgroundColor=''" >
<input type="radio" name="radio1" value="linea2" >Linea2
</div>
<div onmouseover="this.style.backgroundColor='lightblue'" onmouseout="this.style.backgroundColor=''" >
<input type="radio" name="radio1" value="respuesta3">Linea3
</div>
<div onmouseover="this.style.backgroundColor='lightblue'" onmouseout="this.style.backgroundColor=''" >
<input type="radio" name="radio1" value="respuesta4">Linea2
</div>
<br>
<input type="submit" name="Confirmar" value="Enviar Respuesta">
</form>
</body>
</html>
Sobre la educación, sólo puedo decir que es el tema más importante en el que nosotros, como pueblo, debemos involucrarnos.
Abraham Lincoln (1808-1865) Presidente estadounidense.
aprenderaprogramar.com: Desde 2006 comprometidos con la didáctica y divulgación de la programación