RSS
Recortes: 31
Registrado: 6/8/2006
Web
php (13)
mysql (8)
imagenes (5)
JavaScript (5)
jpg (3)
asp (3)
Ajax (2)
jquery (2)
JS (2)
MSSQLServer (2)
XMLHttpRequest (2)
fichero (2)
flash (1)
valor-minimo (1)
recordset (1)
duplicados (1)
menu (1)
event (1)
Transacciones (1)
clase (1)
forms (1)
variable (1)
registros (1)
elimina-ficheros (1)
MS-SQLServer (1)
aleatorio (1)
importar (1)
existe-registro (1)
url (1)
plantilla (1)
connection (1)
genera-select (1)
xhtml (1)
eliminar (1)
scroll (1)
alertas (1)
javascrip (1)
exportar (1)
validacion (1)
provincias (1)
cuenta-registros (1)
leer (1)
html (1)
escribir (1)
sql (1)
antispam (1)
valor-maximo (1)
querystring (1)
declarada (1)
link (1)
adodb (1)
imagen-flash (1)
etiqueta (1)
svg (1)
onload (1)
Me gustó que las etiquetas con los errores de validación se crearan en el momento de mostrar estas alertas y que además salieran con una sutil animación.
<p id="pnombre"> <label id="lnombre">Nombre:</label> <input type="text" id="inombre" name="nombre" /> </p> ... <p class="btn"><a id="send" href="#">[enviar]</a></p>
$(document).ready(function() { $("#send").click(function() { var oForm = document.forms[0]; var oNombre = oForm.elements["nombre"]; var bOk = true; $("p.error").remove(); if(oNombre.value=="") { oNombre.focus(); $("#pnombre" ).after("<p class='error'>Por favor, indíca tu nombre.</p>"); bOk = false; } ... $("p.error").slideDown(); if(bOk) oForm.submit(); return false; }); });
Se trata de un menú totalmente accesible.
Puede tener varios niveles.
Los enlaces a # desplegan un submenu y los enlaces a una página van a ella.
.submenu { display: none; }
<ul id="menu"> <li><a href="#">opcion 1</a><ul class="submenu"> <li><a href="opcion.php">opcion 1.1</a></li> </ul></li> <li><a href="#">opcion 2</a><ul class="submenu"> <li><a href="opcion.php">opcion 2.1</a></li> <li><a href="#">opcion 2.2</a><ul class="submenu"> <li><a href="opcion.php">opcion 2.2.1</a></li> <li><a href="opcion.php">opcion 2.2.2</a></li> </ul></li> </ul></li> </ul>
$(document).ready(function () { $("#menu a").click(fOption); }); function fOption() { var jThis = $(this); var href = jThis.attr("href"); if(href.indexOf("#")>-1) { $(".submenu").css({ display: "none" }); jThis.parent().children("ul").css({ display: "block" }); jThis.parents(".submenu").css({ display: "block" }); return false; } return true; }
Busca URLs en un texto y las convierte en un enlace con la URL como texto enlazable y sin title.
function SnTurls(texto) SnTurls = texto Set regx = New RegExp regx.Pattern = "http:\/\/[a-z]+\.[a-z]+\.[a-z]+\/" set matchs = regx.Execute(texto) for each match in matchs SnTurls = Replace(SnTurls, match, "<a href=""" & match & """>" & match & "</a>") next end function
Cómo compactar el espacio de transacciones asociado a una base de datos.
USE master BACKUP LOG DataBaseName WITH NO_LOG GO USE Cisa2005 DBCC SHRINKFILE(DataBaseName_log,1) GO
Quizás es un poco absurdo, en esta época de frameworks javascript, pero si alguien necesita suscribirse a este evento, sin anular otros posibles scripts que estén escuchándolo, aquí tiene una manera.
f_addEvent(window, "load", f_TuFuncion, false); function f_TuFuncion() { ... } function f_addEvent(elm, evType, fn, useCapture) { if (elm.addEventListener) { elm.addEventListener(evType, fn, useCapture); return true; } else if (elm.attachEvent){ var r = elm.attachEvent("on"+evType, fn); return r; } }
Considerando que pueden haber identificadores que no corresponden ya a ningún registro, este stored procedure devuelve un registro al azar de una tabla
CREATE PROCEDURE getRandomRecord AS SET NOCOUNT ON DECLARE @id int // del registro seleccionado DECLARE @max int // total de registros DECLARE @rnd float // número aleatorio DECLARE @sel int // número aleatorio entero // Averiguamos cuantos registros hay SELECT @max = count(*) FROM t_TABLE // Obtenemos un aleatorio enterio entre 0 y @max SET @rnd = @max * DatePart(ms, GetDate()) / 1000 SET @sel = cast(@rnd as int) // Obtenemos el identificador del registro en esa posición DECLARE crs SCROLL CURSOR FOR SELECT idRecord FROM t_TABLE OPEN crs FETCH ABSOLUTE @sel FROM crs INTO @id CLOSE crs DEALLOCATE crs // Selecionamos dicho registro SELECT * FROM t_TABLE WHERE idRecord = @id GO
<?xml version="1.0"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="300" height="300"> <script type="text/ecmascript"> <![CDATA[ ]]> </script> </svg>
function isDefined(sVarName) { return (typeof(window[sVarName]) == "undefined") ? false : true; }
$file = fopen("filename.ext", "rb"); $text = ''; while (!feof($file)) { $text .= fread($file, 8192); } fclose($file);