<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Linea de Codigo</title>
	
	<link>http://lineadecodigo.com</link>
	<description>/* Programación en la red */</description>
	<lastBuildDate>Sat, 20 Mar 2010 12:53:18 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/LineaDeCodigo" /><feedburner:info uri="lineadecodigo" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Reloj Javascript en una capa</title>
		<link>http://feedproxy.google.com/~r/LineaDeCodigo/~3/cd6etkYCw8U/</link>
		<comments>http://lineadecodigo.com/javascript/reloj-javascript-en-una-capa/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 07:00:12 +0000</pubDate>
		<dc:creator>lineadecodigo</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Date]]></category>
		<category><![CDATA[DIV]]></category>
		<category><![CDATA[getElementById]]></category>
		<category><![CDATA[getHours()]]></category>
		<category><![CDATA[getMinutes()]]></category>
		<category><![CDATA[getSeconds()]]></category>
		<category><![CDATA[HEAD]]></category>
		<category><![CDATA[innerHTML]]></category>
		<category><![CDATA[onLoad]]></category>
		<category><![CDATA[setTimeout]]></category>
		<category><![CDATA[STYLE]]></category>

		<guid isPermaLink="false">http://lineadecodigo.com/?p=2241</guid>
		<description><![CDATA[Uno de los artículos más leidos, aunque no el que más, es el que explica cómo crear un Reloj en JavaScript. En dicho artículo se explica como poner un reloj dentro de un campo input de un formulario. Y claro, esto puede poner bastantes limitaciones en el diseño de nuestra página.
Es por ello que, en [...]]]></description>
			<content:encoded><![CDATA[<p>Uno de los artículos más leidos, aunque no el que más, es el que explica cómo<a href="http://lineadecodigo.com/javascript/reloj-en-javascript/" title="Crear reloj en Javascript"> crear un Reloj en JavaScript</a>. En dicho artículo se explica como poner un reloj dentro de un campo input de un formulario. Y claro, esto puede poner bastantes limitaciones en el diseño de nuestra página.</p>
<p>Es por ello que, en este artículo, explicamos como crear nuevamente el reloj, pero esta vez, su destino será una capa. Esto permite colocar la capa en cualquier parte de la página, facilitando el diseño de la misma.</p>
<p>Bueno pasamos a lo practico. Primeramente obtenemos la fecha y de la fecha mediante los métodos <a href="http://w3api.com/wiki/Javascript:Date.getHours()" title="getHours()">.getHours()</a>, <a href="http://w3api.com/wiki/Javascript:Date.getMinutes()" title="getMinutes()">.getMinutes()</a> y <a href="http://w3api.com/wiki/Javascript:Date.getSeconds()" title="getSeconds()">.getSeconds()</a> obtenemos la hora, minutos y segundos. Recuerda que estos son los datos de la hora de tu maquina.</p>
<p>El código seria el siguiente:</p>
<pre class="javascript"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span>  dia = <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span>  hora = dia.<span style="color: #006600;">getHours</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span>  minutos = dia.<span style="color: #006600;">getMinutes</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span>  segundos = dia.<span style="color: #006600;">getSeconds</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li></ol></pre>
<p>Posteriormente realizaremos una comprobación de que si el valor que tiene en un momento dado cualquiera de las variables anteriores esta entre 0 y 9, añadiremos un cero delante. Simplemente para que nos quede más mona la hora.</p>
<pre class="javascript"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>segundos &gt;= <span style="color: #CC0000;">0</span><span style="color: #66cc66;">&#41;</span>&amp;&amp;<span style="color: #66cc66;">&#40;</span>segundos &lt;= <span style="color: #CC0000;">9</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">  segundos=<span style="color: #3366CC;">&quot;0&quot;</span>+segundos;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li></ol></pre>
<p>Para visualizar la hora en el navegador crearemos una capa. En primer lugar definiremos el estilo que queramos darle a la capa en la cabecera de la página, es decir, dentro de las etiquetas <a href="http://w3api.com/wiki/HTML:HEAD" title="HEAD">&lt;HEAD&gt;</a> y <a href="http://w3api.com/wiki/HTML:HEAD" title="HEAD">&lt;/HEAD&gt;</a>. Para definir el estilo utilizaremos las etiquetas <a href="http://w3api.com/wiki/HTML:STYLE" title="STYLE">&lt;STYLE&gt;</a> y <a href="http://w3api.com/wiki/HTML:STYLE" title="STYLE">&lt;/STYLE&gt;</a> de la siguiente forma:</p>
<pre class="css"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc00cc;">#capa_reloj</span> <span style="color: #66cc66;">&#123;</span>font<span style="color: #3333ff;">:bold</span>; color<span style="color: #3333ff;">:yellow</span>; background<span style="color: #3333ff;">:blue</span>; width<span style="color: #3333ff;">:<span style="color: #933;">70px</span></span>;<span style="color: #66cc66;">&#125;</span></div></li></ol></pre>
<p>En nuestro caso la capa va a tener el fondo azul y las letras amarillas.Pero se puede formatear la capa al gusto del consumidor.</p>
<p>Y segundo incluiremos nuestra capa dentro de la página mediante las etiquetas <a href="http://w3api.com/wiki/HTML:DIV" title="DIV">&lt;DIV&gt;</a> y <a href="http://w3api.com/wiki/HTML:DIV" title="DIV">&lt;/DIV&gt;</a>:</p>
<pre class="html4strict"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://w3api.com/wiki/HTML:div"><span style="color: #000000; font-weight: bold;">&lt;div</span></a> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;capa_reloj&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li></ol></pre>
<p>Deberemos de tener en cuenta que para modificar el contenido de la capa deberemos de utilizar la propiedad innerHTML, en el método en el que mostramos la información:</p>
<pre class="javascript"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">document.<span style="color: #006600;">getElementById</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;capa_reloj&quot;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">innerHTML</span> = time;</div></li></ol></pre>
<p>Y la forma de ejecución es el mostrar la hora cada segundo mediante la función <a href="http://w3api.com/wiki/DOM:Window.setTimeout()" title="setTimeout">setTimeout(cadena,milisegundos)</a>, la cual ejecuta la cadena indicada pasados los milisegundos indicados. (En nuestro caso cada segundo = 1000 milisegundos).</p>
<pre class="javascript"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">window.<span style="color: #006600;">setTimeout</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;mostrar()&quot;</span>,<span style="color: #CC0000;">1000</span><span style="color: #66cc66;">&#41;</span>;</div></li></ol></pre>
<p>También indicar que hay que empezar a ejecutarlo cuando se cargue la pagina, es por ello que utilizaremos el método <a href="http://w3api.com/wiki/HTML:OnLoad" title="onLoad">onLoad()</a>, para empezar a ejecutarlo, mediante <a href="http://w3api.com/wiki/DOM:Window.setTimeout()" title="setTimeOut()">setTimeout</a>.<strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://lineadecodigo.com/javascript/reloj-en-javascript/" rel="bookmark" title="Septiembre 6, 2009">Reloj en JavaScript</a></li>
<li><a href="http://lineadecodigo.com/asp/reloj-con-la-hora-del-servidor/" rel="bookmark" title="Septiembre 7, 2009">Reloj con la hora del servidor</a></li>
<li><a href="http://lineadecodigo.com/java/obtener-la-hora-en-java/" rel="bookmark" title="Enero 25, 2007">Obtener la hora en Java</a></li>
<li><a href="http://lineadecodigo.com/java/milisegundos-a-hora-en-java/" rel="bookmark" title="Marzo 29, 2007">Milisegundos a Hora en Java</a></li>
<li><a href="http://lineadecodigo.com/javascript/cambiar-el-contenido-de-una-capa-con-javascript/" rel="bookmark" title="Marzo 3, 2008">Cambiar el contenido de una capa con JavaScript</a></li>
</ul>
<p><!-- Similar Posts took 4.903 ms --></p>

<p><a href="http://feedads.g.doubleclick.net/~a/8T3thuzQuYFdIoi17AGqKPbA9s0/0/da"><img src="http://feedads.g.doubleclick.net/~a/8T3thuzQuYFdIoi17AGqKPbA9s0/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/8T3thuzQuYFdIoi17AGqKPbA9s0/1/da"><img src="http://feedads.g.doubleclick.net/~a/8T3thuzQuYFdIoi17AGqKPbA9s0/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=cd6etkYCw8U:sMepYSZfxRk:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=cd6etkYCw8U:sMepYSZfxRk:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?i=cd6etkYCw8U:sMepYSZfxRk:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=cd6etkYCw8U:sMepYSZfxRk:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?i=cd6etkYCw8U:sMepYSZfxRk:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=cd6etkYCw8U:sMepYSZfxRk:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=cd6etkYCw8U:sMepYSZfxRk:tKBiNdHYW3c"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=tKBiNdHYW3c" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LineaDeCodigo/~4/cd6etkYCw8U" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://lineadecodigo.com/javascript/reloj-javascript-en-una-capa/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://lineadecodigo.com/javascript/reloj-javascript-en-una-capa/</feedburner:origLink></item>
		<item>
		<title>Imagen con enlace en HTML</title>
		<link>http://feedproxy.google.com/~r/LineaDeCodigo/~3/qhxTUQnWzvY/</link>
		<comments>http://lineadecodigo.com/html/imagen-con-enlace-en-html/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 07:00:47 +0000</pubDate>
		<dc:creator>lineadecodigo</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[A]]></category>
		<category><![CDATA[alt]]></category>
		<category><![CDATA[enlace]]></category>
		<category><![CDATA[href]]></category>
		<category><![CDATA[imagen]]></category>
		<category><![CDATA[IMG]]></category>
		<category><![CDATA[TITLE]]></category>

		<guid isPermaLink="false">http://lineadecodigo.com/?p=2222</guid>
		<description><![CDATA[Aunque lo normal en la web es que los enlaces sean textos, también podemos extender la capacidad de hacer enlaces con imagenes. De esta forma, cuando pulsemos sobre una imagen, esta actuará como enlace y nos llevará al destino demarcado por el enlace.
Para poder hacer esto en HTML, lo primero será poner una imagen. Para [...]]]></description>
			<content:encoded><![CDATA[<p>Aunque lo normal en la web es que los enlaces sean textos, también podemos extender la capacidad de hacer enlaces con imagenes. De esta forma, cuando pulsemos sobre una imagen, esta actuará como enlace y nos llevará al destino demarcado por el enlace.</p>
<p>Para poder hacer esto en <a href="http://www.manualweb.net/tutorial-html/" title="HTML">HTML</a>, lo primero será poner una imagen. Para ello nos basamos en la etiqueta <a href="http://w3api.com/wiki/HTML:IMG" title="img">IMG</a>:</p>
<pre class="html4strict"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://w3api.com/wiki/HTML:img"><span style="color: #000000; font-weight: bold;">&lt;img</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;casarural.jpg&quot;</span> <span style="color: #000066;">alt</span>=<span style="color: #ff0000;">&quot;Los Tejos&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></div></li></ol></pre>
<p>Acordaros, como buena práctica, el poner un texto alternativo a la imagen con el atributo <a href="http://w3api.com/wiki/HTML:Alt" title="alt">alt</a>.</p>
<p>Ahora tendremos que recubrir el código de la imagen con un código de enlace. Para los enlaces nos basamos en la etiqueta <a href="http://w3api.com/wiki/HTML:A" title="A o anchor">A o anchor</a>. Y para indicar el enlace el atributo <a href="http://w3api.com/wiki/HTML:Href" title="href">href</a>. De esta manera el código quedaría de la siguiente forma:</p>
<pre class="html4strict"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://w3api.com/wiki/HTML:a"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;http://www.lostejos.com&quot;</span> <span style="color: #000066;">title</span>=<span style="color: #ff0000;">&quot;Los Tejos&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #009900;"><a href="http://w3api.com/wiki/HTML:img"><span style="color: #000000; font-weight: bold;">&lt;img</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;casarural.jpg&quot;</span> <span style="color: #000066;">alt</span>=<span style="color: #ff0000;">&quot;Los Tejos&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span></div></li></ol></pre>
<p><strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://lineadecodigo.com/html/enlace-a-una-parte-concreta-de-la-pagina/" rel="bookmark" title="Enero 21, 2007">Enlace a una parte concreta de la página</a></li>
<li><a href="http://lineadecodigo.com/jquery/marcar-enlaces-externos-con-jquery/" rel="bookmark" title="Febrero 19, 2009">Marcar enlaces externos con jQuery</a></li>
<li><a href="http://lineadecodigo.com/html/abrir-enlace-en-una-nueva-ventana/" rel="bookmark" title="Diciembre 22, 2006">Abrir enlace en una nueva ventana</a></li>
<li><a href="http://lineadecodigo.com/javascript/obtener-el-contenido-de-un-elemento-conociendo-su-tag/" rel="bookmark" title="Agosto 17, 2007">Obtener el contenido de un elemento conociendo su TAG</a></li>
<li><a href="http://lineadecodigo.com/html/alto-y-ancho-de-una-imagen-con-html/" rel="bookmark" title="Diciembre 4, 2007">Alto y ancho de una imagen con HTML</a></li>
</ul>
<p><!-- Similar Posts took 4.822 ms --></p>

<p><a href="http://feedads.g.doubleclick.net/~a/g-U8v_FTnK8nhvQsoMlgCzcvaxo/0/da"><img src="http://feedads.g.doubleclick.net/~a/g-U8v_FTnK8nhvQsoMlgCzcvaxo/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/g-U8v_FTnK8nhvQsoMlgCzcvaxo/1/da"><img src="http://feedads.g.doubleclick.net/~a/g-U8v_FTnK8nhvQsoMlgCzcvaxo/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=qhxTUQnWzvY:l5Si_lveINc:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=qhxTUQnWzvY:l5Si_lveINc:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?i=qhxTUQnWzvY:l5Si_lveINc:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=qhxTUQnWzvY:l5Si_lveINc:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?i=qhxTUQnWzvY:l5Si_lveINc:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=qhxTUQnWzvY:l5Si_lveINc:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=qhxTUQnWzvY:l5Si_lveINc:tKBiNdHYW3c"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=tKBiNdHYW3c" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LineaDeCodigo/~4/qhxTUQnWzvY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://lineadecodigo.com/html/imagen-con-enlace-en-html/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://lineadecodigo.com/html/imagen-con-enlace-en-html/</feedburner:origLink></item>
		<item>
		<title>Repaginar con jQuery y AJAX</title>
		<link>http://feedproxy.google.com/~r/LineaDeCodigo/~3/S9KY9e2VcBk/</link>
		<comments>http://lineadecodigo.com/jquery/repaginar-con-jquery-y-ajax/#comments</comments>
		<pubDate>Sun, 31 Jan 2010 23:09:39 +0000</pubDate>
		<dc:creator>lineadecodigo</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[button]]></category>
		<category><![CDATA[click]]></category>
		<category><![CDATA[DIV]]></category>
		<category><![CDATA[GET]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[repaginar]]></category>

		<guid isPermaLink="false">http://lineadecodigo.com/?p=2221</guid>
		<description><![CDATA[En unas pocas líneas vamos a ver lo sencillo que es repaginar utilizando jQuery y AJAX. El ejemplo que vamos a montar es el típico en el cual un servicio de datos nos devuelve mensajes, mientras que nosotros, en la parte cliente realizaremos repaginaciones mediante peticiones AJAX a ese servicio.
En primer lugar contaremos con un [...]]]></description>
			<content:encoded><![CDATA[<p>En unas pocas líneas vamos a ver lo sencillo que es repaginar utilizando <a href="http://www.manualweb.net/tutorial-jquery/" title="jQuery">jQuery</a> y <a href="http://www.manualweb.net/tutorial-ajax/" title="AJAX">AJAX</a>. El ejemplo que vamos a montar es el típico en el cual un servicio de datos nos devuelve mensajes, mientras que nosotros, en la parte cliente realizaremos repaginaciones mediante peticiones <a href="http://www.manualweb.net/tutorial-ajax/" title="AJAX">AJAX</a> a ese servicio.</p>
<p>En primer lugar contaremos con un servicio de datos que daremos por construido, al que llamaremos datos.php. Este servicio puede recibir por parámetro el valor de la página de datos a mostrar. Siguiendo la siguiente sintaxis:</p>
<pre>datos.php?pagina=1 //Nos devolverá la primera página
datos.php?pagina=5 //Nos devolverá la quinta página</pre>
<p>En posteriores artículos entraremos en detalle de como construir esta página con <a href="http://www.manualweb.net/tutorial-php/" title="PHP">PHP</a> de forma sencilla. Pero de momento nos vamos a centrar en el desarrollo de la parte cliente con <a href="http://www.manualweb.net/tutorial-jquery/" title="jQuery">jQuery</a> para realizar peticiones <a href="http://www.manualweb.net/tutorial-ajax/" title="AJAX">AJAX</a>.</p>
<p>Lo primero será la estructura de la página. Esta tendrá una capa donde volcaremos los mensajes, y dos botones que nos permitirán el ir hacía delante y hacía detrás.</p>
<pre class="html4strict"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://w3api.com/wiki/HTML:div"><span style="color: #000000; font-weight: bold;">&lt;div</span></a> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;mensajes&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://w3api.com/wiki/HTML:button"><span style="color: #000000; font-weight: bold;">&lt;button</span></a> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;anterior&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Anterior<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/button&gt;</span></span> | <span style="color: #009900;"><a href="http://w3api.com/wiki/HTML:button"><span style="color: #000000; font-weight: bold;">&lt;button</span></a> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;siguiente&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Siguiente<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/button&gt;</span></span> </div></li></ol></pre>
<p>Vemos que no tiene nada de código <a href="http://www.manualweb.net/tutorial-javascript/" title="javascript">Javascript</a>, y es que este le inyectaremos de forma no intrusiva mediante <a href="http://www.manualweb.net/tutorial-jquery/" title="jQuery">jQuery</a>.</p>
<p>La inicialización de <a href="http://www.manualweb.net/tutorial-jquery/" title="jQuery">jQuery</a>, tan sencilla como una línea:</p>
<pre class="html4strict"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://w3api.com/wiki/HTML:script"><span style="color: #000000; font-weight: bold;">&lt;script</span></a> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;jquery.js&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/script&gt;</span></span></div></li></ol></pre>
<p>De forma general vamos a definir una variable llamada página, la cual representa la página de mensajes a visualizar:</p>
<pre class="javascript"><span style="color: #003366; font-weight: bold;">var</span> pagina=<span style="color: #CC0000;">1</span>;</pre>
<p>La inicializamos a un valor de 1 para que esta sea la primera página a visualizar.</p>
<p>Lo siguiente será codificar las acciones de click sobre los botones. El método que nos permite capturar un click sobre un elemento es el método <a href="http://w3api.com/wiki/jQuery:Click()" title="click">.click()</a> de <a href="http://www.manualweb.net/tutorial-jquery/" title="jQuery">jQuery</a>. La codificación de los botones será muy sencilla. Los pasos que seguirán serán.</p>
<ol>
<li>Decrementar el valor de una variable general llamado página</li>
<li>Llamar a una función cargardatos(); la cual implementará las peticiones <a href="http://www.manualweb.net/tutorial-ajax/" title="AJAX">AJAX</a></li>
</ol>
<p>El código quedará de la siguiente manera:</p>
<pre class="javascript">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;#anterior&quot;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">click</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
  pagina--;
  cargardatos<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;#siguiente&quot;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">click</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
  pagina++;
  cargardatos<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</pre>
<p>Como nuestras peticiones AJAX no van a ser muy complejas la función cargardatos se apoyará en el método <a href="http://w3api.com/wiki/jQuery:Get()" title="get()">.get()</a> el cual hace peticiones <a href="http://www.manualweb.net/tutorial-ajax/" title="AJAX">AJAX</a> de tipo GET. Aunque la función <a href="http://w3api.com/wiki/jQuery:Get()" title="get()">.get()</a> tiene varios parámetros (échale un vistazo a los <a href="http://w3api.com/wiki/jQuery:Get()" title="parametros de la funcion get()">parámetros de la función .get()</a>) nosotros vamos a utilizar 2.</p>
<p>El primer parámetro indicará el origen de datos que nos devuelve el contenido. Es decir, datos.php. Como la URL a montar varía dependiendo del valor de la página en la que estemos, tenemos que apoyarnos en el valor de la variable global página que estabamos utilizando</p>
<pre class="javascript"><span style="color: #3366CC;">&quot;datos.php?pagina=&quot;</span>+pagina;</pre>
<p>El segundo parámetro de la función <a href="http://w3api.com/wiki/jQuery:Get()" title="get()">.get()</a> es un función que recibe un parámetro data con los datos de la respuesta y cuyo contenido es las acciones que vamos a realizar sobre ellos. En nuestro caso el contenido lo vamos a añadir a la capa "mensajes". Apoyándonos en el método <a href="http://w3api.com/wiki/jQuery:Html()" title="html">.html()</a>, el cual incluirá ese contenido sobre la capa.</p>
<pre class="javascript"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>data<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>data != <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">    $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;#mensajes&quot;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">html</span><span style="color: #66cc66;">&#40;</span>data<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li></ol></pre>
<p>Así, el código completo de la función cargardatos() quedará de la siguiente forma:</p>
<pre class="javascript"><span style="color: #003366; font-weight: bold;">function</span> cargardatos<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
  $.<span style="color: #006600;">get</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;datos.php?pagina=&quot;</span>+pagina,
   <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>data<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>data != <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
     $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;#mensajes&quot;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">html</span><span style="color: #66cc66;">&#40;</span>data<span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
    <span style="color: #66cc66;">&#125;</span>
  <span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre>
<p>Unas pocas líneas y algo que parece tan complejo como repaginar con <a href="http://www.manualweb.net/tutorial-jquery/" title="jQuery">jQuery</a> y <a href="http://www.manualweb.net/tutorial-ajax/" title="AJAX">AJAX</a>... resuelto.<strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://lineadecodigo.com/jquery/peticiones-ajax-con-jquery/" rel="bookmark" title="Enero 6, 2010">Peticiones AJAX con jQuery</a></li>
<li><a href="http://lineadecodigo.com/jquery/hola-mundo-con-jquery/" rel="bookmark" title="Enero 23, 2009">Hola Mundo con jQuery</a></li>
<li><a href="http://lineadecodigo.com/ajax/repaginar-datos-con-ajax/" rel="bookmark" title="Agosto 6, 2009">Repaginar datos con AJAX</a></li>
<li><a href="http://lineadecodigo.com/jquery/cargar-un-fichero-con-jquery/" rel="bookmark" title="Enero 25, 2009">Cargar un fichero con jQuery</a></li>
<li><a href="http://lineadecodigo.com/jquery/modificar-el-estilo-con-jquery/" rel="bookmark" title="Enero 24, 2009">Modificar el estilo con jQuery</a></li>
</ul>
<p><!-- Similar Posts took 5.874 ms --></p>

<p><a href="http://feedads.g.doubleclick.net/~a/DxX3eVNgX63ThoS0NwkniGQqfXg/0/da"><img src="http://feedads.g.doubleclick.net/~a/DxX3eVNgX63ThoS0NwkniGQqfXg/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/DxX3eVNgX63ThoS0NwkniGQqfXg/1/da"><img src="http://feedads.g.doubleclick.net/~a/DxX3eVNgX63ThoS0NwkniGQqfXg/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=S9KY9e2VcBk:8XiK3j-ceY4:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=S9KY9e2VcBk:8XiK3j-ceY4:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?i=S9KY9e2VcBk:8XiK3j-ceY4:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=S9KY9e2VcBk:8XiK3j-ceY4:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?i=S9KY9e2VcBk:8XiK3j-ceY4:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=S9KY9e2VcBk:8XiK3j-ceY4:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=S9KY9e2VcBk:8XiK3j-ceY4:tKBiNdHYW3c"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=tKBiNdHYW3c" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LineaDeCodigo/~4/S9KY9e2VcBk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://lineadecodigo.com/jquery/repaginar-con-jquery-y-ajax/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://lineadecodigo.com/jquery/repaginar-con-jquery-y-ajax/</feedburner:origLink></item>
		<item>
		<title>Utilizar la ñ en HTML</title>
		<link>http://feedproxy.google.com/~r/LineaDeCodigo/~3/jRqvEDMjrVI/</link>
		<comments>http://lineadecodigo.com/html/utilizar-la-n-en-html/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 20:00:15 +0000</pubDate>
		<dc:creator>lineadecodigo</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[ñ]]></category>
		<category><![CDATA[caracteres escapados]]></category>

		<guid isPermaLink="false">http://lineadecodigo.com/?p=2212</guid>
		<description><![CDATA[A la hora de escribir documentos HTML y publicarlos en la web tenemos que tener en cuenta que, estos, son susceptibles de ser visualizados por personas de muchos sitios. Y que estas personas tendrán diferentes configuraciones de sus navegadores. Es por ello que tenemos que prestar especial atención cuando utilicemos símbolos especiales de los idiomas.
Esto [...]]]></description>
			<content:encoded><![CDATA[<p>A la hora de escribir documentos <a href="http://www.manualweb.net/tutorial-html/" title="HTML">HTML</a> y publicarlos en la web tenemos que tener en cuenta que, estos, son susceptibles de ser visualizados por personas de muchos sitios. Y que estas personas tendrán diferentes configuraciones de sus navegadores. Es por ello que tenemos que prestar especial atención cuando utilicemos símbolos especiales de los idiomas.</p>
<p>Esto nos va a aparecer si utilizamos codificaciones de codificación locales, como puede ser la ISO-8859-1.</p>
<pre class="html4strict"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://w3api.com/wiki/HTML:meta"><span style="color: #000000; font-weight: bold;">&lt;meta</span></a> <span style="color: #000066;">http-equiv</span>=<span style="color: #ff0000;">&quot;Content-Type&quot;</span> <span style="color: #000066;">content</span>=<span style="color: #ff0000;">&quot;text/html; charset=ISO-8859-1&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></div></li></ol></pre>
<p>Este es el caso de la &Ntilde;, letra que solo encontramos en el alfabeto español. Así, si queremos utilizar la &ntilde; en nuestros documentos <a href="http://www.manualweb.net/tutorial-html/" title="HTML">HTML</a>, lo mejor que podemos hacer es escaparla. Para ello, en vez de escribirla directamente la deberíamos de escribir de la siguiente forma:</p>
<pre class="html4strict"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ddbb00;">&amp;ntilde;</span></div></li></ol></pre>
<p>O en mayúsculas:</p>
<pre class="html4strict"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ddbb00;">&amp;Ntilde;</span></div></li></ol></pre>
<p>De esta forma podríamos tener textos como...</p>
<pre class="html4strict"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">La capital de Espa<span style="color: #ddbb00;">&amp;amp;</span>ntilde;a es Madrid</div></li></ol></pre>
<p>...que se visualizaría de la siguiente forma:</p>
<p><strong>La capital de Espa&ntilde;a es Madrid</strong></p>
<p>Otra opción, siempre y que podamos, es utilizar una codificación UTF-8, que nos evita estos problemas:</p>
<pre class="html4strict"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://w3api.com/wiki/HTML:meta"><span style="color: #000000; font-weight: bold;">&lt;meta</span></a> <span style="color: #000066;">http-equiv</span>=<span style="color: #ff0000;">&quot;Content-Type&quot;</span> <span style="color: #000066;">content</span>=<span style="color: #ff0000;">&quot;text/html; charset=UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></div></li></ol></pre>
<p><strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://lineadecodigo.com/html/combos-de-seleccion/" rel="bookmark" title="Noviembre 2, 2006">Combos de selección</a></li>
<li><a href="http://lineadecodigo.com/html/alto-y-ancho-de-una-imagen-con-html/" rel="bookmark" title="Diciembre 4, 2007">Alto y ancho de una imagen con HTML</a></li>
<li><a href="http://lineadecodigo.com/html/subindice-en-html/" rel="bookmark" title="Enero 15, 2009">Subindice en HTML</a></li>
<li><a href="http://lineadecodigo.com/eventos/dia-w3c-en-espana-2007/" rel="bookmark" title="Mayo 16, 2007">Día W3C en España 2007</a></li>
<li><a href="http://lineadecodigo.com/html/predeterminar-valor-en-un-combo/" rel="bookmark" title="Noviembre 16, 2006">Predeterminar valor en un combo</a></li>
</ul>
<p><!-- Similar Posts took 4.972 ms --></p>

<p><a href="http://feedads.g.doubleclick.net/~a/gbT7HZcgs05jbIzGym-ibiyNwSw/0/da"><img src="http://feedads.g.doubleclick.net/~a/gbT7HZcgs05jbIzGym-ibiyNwSw/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/gbT7HZcgs05jbIzGym-ibiyNwSw/1/da"><img src="http://feedads.g.doubleclick.net/~a/gbT7HZcgs05jbIzGym-ibiyNwSw/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=jRqvEDMjrVI:-6I4tc_LDCI:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=jRqvEDMjrVI:-6I4tc_LDCI:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?i=jRqvEDMjrVI:-6I4tc_LDCI:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=jRqvEDMjrVI:-6I4tc_LDCI:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?i=jRqvEDMjrVI:-6I4tc_LDCI:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=jRqvEDMjrVI:-6I4tc_LDCI:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=jRqvEDMjrVI:-6I4tc_LDCI:tKBiNdHYW3c"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=tKBiNdHYW3c" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LineaDeCodigo/~4/jRqvEDMjrVI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://lineadecodigo.com/html/utilizar-la-n-en-html/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://lineadecodigo.com/html/utilizar-la-n-en-html/</feedburner:origLink></item>
		<item>
		<title>Volcar el contenido de la sesión en ASP</title>
		<link>http://feedproxy.google.com/~r/LineaDeCodigo/~3/KKuIe9R52n4/</link>
		<comments>http://lineadecodigo.com/asp/volcar-el-contenido-de-la-sesion-en-asp/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 07:00:52 +0000</pubDate>
		<dc:creator>lineadecodigo</dc:creator>
				<category><![CDATA[ASP]]></category>
		<category><![CDATA[contents]]></category>
		<category><![CDATA[CStr]]></category>
		<category><![CDATA[for]]></category>
		<category><![CDATA[LBound]]></category>
		<category><![CDATA[response]]></category>
		<category><![CDATA[Response.Write]]></category>
		<category><![CDATA[Session]]></category>
		<category><![CDATA[UBound]]></category>

		<guid isPermaLink="false">http://lineadecodigo.com/?p=2206</guid>
		<description><![CDATA[Mediante este simple ejemplo buscamos ver cómo listar los datos que un usuario tiene almacenados en su sesión. En primer lugar hay que recordar que los datos de sesión están almacenados mientras el usuario realiza una navegación por nuestra web.
La forma que ASP nos ofrece para recuperar y poner información es el objeto Session. Si [...]]]></description>
			<content:encoded><![CDATA[<p>Mediante este simple ejemplo buscamos ver cómo listar los datos que un usuario tiene almacenados en su sesión. En primer lugar hay que recordar que los datos de sesión están almacenados mientras el usuario realiza una navegación por nuestra web.</p>
<p>La forma que <a href="http://www.manualweb.net/tutorial-asp/" title="ASP">ASP</a> nos ofrece para recuperar y poner información es el objeto <a href="http://w3api.com/wiki/ASP:Session" title="Session">Session</a>. Si en este punto no sabemos como hacer esto es útil leerse el articulo <a href="http://lineadecodigo.com/asp/guardar-informacion-del-usuario-en-la-sesion-con-asp/" title="Guardar información en la sesión del usuario">Guardar información en la sesión del usuario</a>.</p>
<p>En nuestro caso desconocemos el nombre de la variable que almacena el dato en sesión. Ya que sino podríamos utilizar la sentencia...</p>
<pre class="asp"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #990099; font-weight: bold;">Session</span><span style="color: #006600; font-weight:bold">&#40;</span><span style="color: #cc0000;">&quot;nombreVariable&quot;</span><span style="color: #006600; font-weight:bold">&#41;</span></div></li></ol></pre>
<p>...para recuperarla.</p>
<p>Lo que el objeto <a href="http://w3api.com/wiki/ASP:Session" title="Session">Session</a> nos ofrece es la colección <a href="http://w3api.com/wiki/ASP:Session.Contents" title="Contents">Contents</a>, la cual, alberga a todas las variables instanciadas en sesión. Nos podemos valer de un bucle iterativo como for each para recuperarlas todas y mostrarlas en pantalla.</p>
<pre class="asp"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #990099; font-weight: bold;">for</span> <span style="color: #990099; font-weight: bold;">each</span> x <span style="color: #990099; font-weight: bold;">in</span> <span style="color: #990099; font-weight: bold;">Session</span>.<span style="color: #9900cc;">Contents</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">  <span style="color: #990099; font-weight: bold;">Response</span>.<span style="color: #330066;">Write</span><span style="color: #006600; font-weight:bold">&#40;</span>x + <span style="color: #cc0000;">&quot; =&quot;</span> + <span style="color: #990099; font-weight: bold;">Session</span>.<span style="color: #9900cc;">Contents</span><span style="color: #006600; font-weight:bold">&#40;</span>x<span style="color: #006600; font-weight:bold">&#41;</span> + <span style="color: #cc0000;">&quot;&lt;br&gt;&quot;</span><span style="color: #006600; font-weight:bold">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #990099; font-weight: bold;">next</span></div></li></ol></pre>
<p>En el caso de que la variable almacenada en sesión sea un array se nos producirá un error. Es por ello que hay que controlar que la variable sea o no un array mediante la función IsArray().</p>
<pre class="asp"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">IsArray<span style="color: #006600; font-weight:bold">&#40;</span><span style="color: #990099; font-weight: bold;">Session</span><span style="color: #006600; font-weight:bold">&#40;</span>x<span style="color: #006600; font-weight:bold">&#41;</span><span style="color: #006600; font-weight:bold">&#41;</span></div></li></ol></pre>
<p>En el caso de que el elemento sea un array, tendremos que recorrer todos sus elementos. Para este caso, un bucle for desde el primer elemento del array hasta el último sería suficiente.</p>
<pre class="asp"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #990099; font-weight: bold;">For</span> w = <span style="color: #330066;">LBound</span><span style="color: #006600; font-weight:bold">&#40;</span><span style="color: #990099; font-weight: bold;">Session</span><span style="color: #006600; font-weight:bold">&#40;</span>x<span style="color: #006600; font-weight:bold">&#41;</span><span style="color: #006600; font-weight:bold">&#41;</span> <span style="color: #990099; font-weight: bold;">to</span> <span style="color: #330066;">UBound</span><span style="color: #006600; font-weight:bold">&#40;</span><span style="color: #990099; font-weight: bold;">Session</span><span style="color: #006600; font-weight:bold">&#40;</span>x<span style="color: #006600; font-weight:bold">&#41;</span><span style="color: #006600; font-weight:bold">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">  <span style="color: #990099; font-weight: bold;">Response</span>.<span style="color: #330066;">Write</span><span style="color: #006600; font-weight:bold">&#40;</span>x + <span style="color: #cc0000;">&quot;[&quot;</span> + <span style="color: #990099; font-weight: bold;">CStr</span><span style="color: #006600; font-weight:bold">&#40;</span>w<span style="color: #006600; font-weight:bold">&#41;</span> + <span style="color: #cc0000;">&quot;] = &quot;</span> + <span style="color: #990099; font-weight: bold;">Session</span><span style="color: #006600; font-weight:bold">&#40;</span>x<span style="color: #006600; font-weight:bold">&#41;</span><span style="color: #006600; font-weight:bold">&#40;</span>w<span style="color: #006600; font-weight:bold">&#41;</span> + <span style="color: #cc0000;">&quot;&lt;br&gt;&quot;</span><span style="color: #006600; font-weight:bold">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #990099; font-weight: bold;">Next</span></div></li></ol></pre>
<p><strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://lineadecodigo.com/asp/guardar-informacion-del-usuario-en-la-sesion-con-asp/" rel="bookmark" title="Octubre 25, 2009">Guardar información del usuario en la sesión con ASP</a></li>
<li><a href="http://lineadecodigo.com/asp/inicializar-variables-de-sesion-en-asp/" rel="bookmark" title="Diciembre 2, 2009">Inicializar variables de sesión en ASP</a></li>
<li><a href="http://lineadecodigo.com/asp/numero-de-usuarios-activos-en-asp/" rel="bookmark" title="Septiembre 24, 2009">Numero de usuarios activos en ASP</a></li>
<li><a href="http://lineadecodigo.com/asp/obtener-id-de-sesion-en-asp/" rel="bookmark" title="Septiembre 21, 2009">Obtener ID de sesión en ASP</a></li>
<li><a href="http://lineadecodigo.com/java/modificar-time-out-de-sesion/" rel="bookmark" title="Noviembre 12, 2006">Modificar time-out de sesión</a></li>
</ul>
<p><!-- Similar Posts took 5.104 ms --></p>

<p><a href="http://feedads.g.doubleclick.net/~a/WOsrQNCmjjPrEALcis3P1F4b-bs/0/da"><img src="http://feedads.g.doubleclick.net/~a/WOsrQNCmjjPrEALcis3P1F4b-bs/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/WOsrQNCmjjPrEALcis3P1F4b-bs/1/da"><img src="http://feedads.g.doubleclick.net/~a/WOsrQNCmjjPrEALcis3P1F4b-bs/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=KKuIe9R52n4:34YJtUtraaw:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=KKuIe9R52n4:34YJtUtraaw:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?i=KKuIe9R52n4:34YJtUtraaw:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=KKuIe9R52n4:34YJtUtraaw:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?i=KKuIe9R52n4:34YJtUtraaw:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=KKuIe9R52n4:34YJtUtraaw:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=KKuIe9R52n4:34YJtUtraaw:tKBiNdHYW3c"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=tKBiNdHYW3c" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LineaDeCodigo/~4/KKuIe9R52n4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://lineadecodigo.com/asp/volcar-el-contenido-de-la-sesion-en-asp/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://lineadecodigo.com/asp/volcar-el-contenido-de-la-sesion-en-asp/</feedburner:origLink></item>
		<item>
		<title>Insertar un registro en una BD con ADO</title>
		<link>http://feedproxy.google.com/~r/LineaDeCodigo/~3/PGebFLM56QM/</link>
		<comments>http://lineadecodigo.com/asp/insertar-un-registro-en-una-bd-con-ado/#comments</comments>
		<pubDate>Fri, 08 Jan 2010 20:03:42 +0000</pubDate>
		<dc:creator>lineadecodigo</dc:creator>
				<category><![CDATA[ASP]]></category>
		<category><![CDATA[ADO]]></category>
		<category><![CDATA[base de datos]]></category>
		<category><![CDATA[BD]]></category>
		<category><![CDATA[Connection]]></category>
		<category><![CDATA[INSERT]]></category>
		<category><![CDATA[RecordSet]]></category>
		<category><![CDATA[SELECT]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://lineadecodigo.com/?p=2203</guid>
		<description><![CDATA[Lo primero que tenemos que hacer para poder insertar un registro en una BD con ADO es conectarnos a la base de datos a través de un objeto Connection. A este objeto hay que pasarle la cadena de conexión indicando donde se encuentra la base de datos. Nosotros vamos a hacer la conexión, en este [...]]]></description>
			<content:encoded><![CDATA[<p>Lo primero que tenemos que hacer para poder insertar un registro en una BD con <a href="http://www.manualweb.net/tutorial-ado/" title="ADO">ADO</a> es conectarnos a la base de datos a través de un objeto <a href="http://www.w3api.com/wiki/ADO:Connection" title="Connection">Connection</a>. A este objeto hay que pasarle la cadena de conexión indicando donde se encuentra la base de datos. Nosotros vamos a hacer la conexión, en este caso, sin usar DSN. Es más recomendable <a href="http://lineadecodigo.com/asp/acceder-a-una-base-de-datos-con-asp/" title="conectarse a la base de datos vía un DSN">conectarse a la base de datos vía un DSN</a>, pero esto nos permite ver código nuevo.</p>
<p>Accederemos al fichero directamente:</p>
<pre class="asp"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #990099; font-weight: bold;">Set</span> db = <span style="color: #990099; font-weight: bold;">Server</span>.<span style="color: #330066;">CreateObject</span><span style="color: #006600; font-weight:bold">&#40;</span><span style="color: #cc0000;">&quot;ADODB.Connection&quot;</span><span style="color: #006600; font-weight:bold">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #990099; font-weight: bold;">Dim</span> DB_CONNECTIONSTRING</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">DB_CONNECTIONSTRING = <span style="color: #cc0000;">&quot;Driver={Microsoft Access Driver (*.mdb)};Dbq=&quot;</span> &amp; <span style="color: #990099; font-weight: bold;">Server</span>.<span style="color: #330066;">MapPath</span><span style="color: #006600; font-weight:bold">&#40;</span><span style="color: #cc0000;">&quot;/db/prueba.mdb&quot;</span><span style="color: #006600; font-weight:bold">&#41;</span> &amp; <span style="color: #cc0000;">&quot;;&quot;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">db.<span style="color: #330066;">open</span> DB_CONNECTIONSTRING</div></li></ol></pre>
<p>Tanto en el acceso con DSN o sin DSN el objeto utilizado es un <a href="http://www.w3api.com/wiki/ADO:Connection" title="ADODB.Connection">ADODB.Connection</a></p>
<p>Una vez que hemos abierto la conexión con la base de datos tendremos que comprobar que el texto a insertar no existe en la base de datos. Para realizar esta comprobación utilizamos una sentencia SELECT y un objeto <a href="http://www.w3api.com/wiki/ADO:RecordSet" title="ADODB.Recordset">ADODB.Recordset</a>.</p>
<pre class="asp"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #990099; font-weight: bold;">set</span> rs_existe = <span style="color: #990099; font-weight: bold;">Server</span>.<span style="color: #330066;">CreateObject</span><span style="color: #006600; font-weight:bold">&#40;</span><span style="color: #cc0000;">&quot;ADODB.Recordset&quot;</span><span style="color: #006600; font-weight:bold">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">QLStr = <span style="color: #cc0000;">&quot;SELECT valor FROM datos WHERE valor ='&quot;</span> + texto_insertar  + <span style="color: #cc0000;">&quot;'&quot;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">rs_existe.<span style="color: #330066;">open</span> SQLStr, DB_CONNECTIONSTRING, adOpenStatic, adLockReadOnly, adCmdText</div></li></ol></pre>
<p>En el caso de que esta búsqueda no nos devuelva ningún registro de la base de datos esto significa que la palabra a insertar no existe en nuestra base de datos. Es por ello que procederemos a realizar la inserción.</p>
<p>Lo que estamos haciendo es montar una sentencia SQL de tipo INSERT, la cual ejecutaremos sobre otro <a href="http://www.w3api.com/wiki/ADO:RecordSet" title="ADODB.Recordset">ADODB.Recordset</a></p>
<pre class="asp"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #990099; font-weight: bold;">if</span> <span style="color: #990099; font-weight: bold;">not</span> <span style="color: #006600; font-weight:bold">&#40;</span>rs_existe.<span style="color: #0000ff; font-weight: bold;">EOF</span><span style="color: #006600; font-weight:bold">&#41;</span> <span style="color: #990099; font-weight: bold;">then</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">    <span style="color: #990099; font-weight: bold;">Response</span>.<span style="color: #330066;">Write</span> <span style="color: #006600; font-weight:bold">&#40;</span><span style="color: #cc0000;">&quot;El valor a insertar ya existe&quot;</span><span style="color: #006600; font-weight:bold">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #990099; font-weight: bold;">else</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">    <span style="color: #990099; font-weight: bold;">set</span> rs_insert = <span style="color: #990099; font-weight: bold;">Server</span>.<span style="color: #330066;">CreateObject</span><span style="color: #006600; font-weight:bold">&#40;</span><span style="color: #cc0000;">&quot;ADODB.Recordset&quot;</span><span style="color: #006600; font-weight:bold">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">    SQLStr = <span style="color: #cc0000;">&quot;INSERT INTO datos VALUES ('&quot;</span> + texto_recibido + <span style="color: #cc0000;">&quot;')&quot;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">    rs_insert.<span style="color: #330066;">open</span> SQLStr, DB_CONNECTIONSTRING, adOpenStatic, adLockReadOnly,adCmdText</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">    <span style="color: #990099; font-weight: bold;">Response</span>.<span style="color: #330066;">Write</span> <span style="color: #006600; font-weight:bold">&#40;</span><span style="color: #cc0000;">&quot;Insertado el valor &quot;</span> + texto_recibido<span style="color: #006600; font-weight:bold">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #990099; font-weight: bold;">end</span> <span style="color: #990099; font-weight: bold;">if</span></div></li></ol></pre>
<p>Para realizar una inserción en una base de datos utilizamos la sentencia INSERT; la cual tiene la siguiente forma:</p>
<pre class="sql"><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> tabla<span style="color: #66cc66;">&#91;</span>s<span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#40;</span>campo<span style="color: #66cc66;">&#91;</span>s<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span>valor1, valor2,..., valorN<span style="color: #66cc66;">&#41;</span></pre>
<p>Los valores deberán de coincidir con su posición en la tabla de la base de datos.</p>
<p>Con unas pocas líneas de código tenemos nuestro fichero <a href="http://www.manualweb.net/tutorial-asp/" title="ASP">ASP</a> que utiliza los objetos de <a href="http://www.manualweb.net/tutorial-ado/" title="ADO">ADO</a> para insertar un registro en una BD.<strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://lineadecodigo.com/asp/acceder-a-una-base-de-datos-con-asp/" rel="bookmark" title="Octubre 1, 2009">Acceder a una base de datos con ASP</a></li>
<li><a href="http://lineadecodigo.com/asp/cargar-combos-desde-una-base-de-datos-con-ado/" rel="bookmark" title="Febrero 23, 2009">Cargar combos desde una Base de Datos con ADO</a></li>
<li><a href="http://lineadecodigo.com/asp/borrar-registros-de-una-base-de-datos-con-ado/" rel="bookmark" title="Febrero 22, 2009">Borrar registros de una base de datos con ADO</a></li>
<li><a href="http://lineadecodigo.com/asp/leer-de-un-excel-con-asp/" rel="bookmark" title="Septiembre 3, 2009">Leer de un Excel con ASP</a></li>
<li><a href="http://lineadecodigo.com/java/insertar-datos-con-jdbc/" rel="bookmark" title="Junio 7, 2007">Insertar datos con JDBC</a></li>
</ul>
<p><!-- Similar Posts took 8.470 ms --></p>

<p><a href="http://feedads.g.doubleclick.net/~a/OpTJDvxCDojN101wvl9arvJpU5c/0/da"><img src="http://feedads.g.doubleclick.net/~a/OpTJDvxCDojN101wvl9arvJpU5c/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/OpTJDvxCDojN101wvl9arvJpU5c/1/da"><img src="http://feedads.g.doubleclick.net/~a/OpTJDvxCDojN101wvl9arvJpU5c/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=PGebFLM56QM:ucxgAekTnx4:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=PGebFLM56QM:ucxgAekTnx4:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?i=PGebFLM56QM:ucxgAekTnx4:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=PGebFLM56QM:ucxgAekTnx4:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?i=PGebFLM56QM:ucxgAekTnx4:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=PGebFLM56QM:ucxgAekTnx4:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=PGebFLM56QM:ucxgAekTnx4:tKBiNdHYW3c"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=tKBiNdHYW3c" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LineaDeCodigo/~4/PGebFLM56QM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://lineadecodigo.com/asp/insertar-un-registro-en-una-bd-con-ado/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://lineadecodigo.com/asp/insertar-un-registro-en-una-bd-con-ado/</feedburner:origLink></item>
		<item>
		<title>Obtener los códigos ASCII de una cadena de texto</title>
		<link>http://feedproxy.google.com/~r/LineaDeCodigo/~3/KH13N-x96Uo/</link>
		<comments>http://lineadecodigo.com/java/obtener-los-codigos-ascii-de-una-cadena-de-texto/#comments</comments>
		<pubDate>Thu, 07 Jan 2010 07:00:15 +0000</pubDate>
		<dc:creator>lineadecodigo</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[ASCII]]></category>
		<category><![CDATA[charAt]]></category>
		<category><![CDATA[codePointAt]]></category>
		<category><![CDATA[codigo]]></category>
		<category><![CDATA[length]]></category>

		<guid isPermaLink="false">http://lineadecodigo.com/?p=2190</guid>
		<description><![CDATA[En este ejemplo vamos a ver como obtenemos los códigos ASCII de una cadena de texto con Java. Para ello recorreremos los caracteres de la cadena e iremos obteniendo el código. Para ello nos apoyamos en el método .codePointAt().
El método .codePointAt() devuelve el código ASCII de un carácter en concreto. El carácter será el que [...]]]></description>
			<content:encoded><![CDATA[<p>En este ejemplo vamos a ver como obtenemos los códigos ASCII de una cadena de texto con <a href="http://www.manualweb.net/tutorial-java/" title="Java">Java</a>. Para ello recorreremos los caracteres de la cadena e iremos obteniendo el código. Para ello nos apoyamos en el método <a href="http://www.w3api.com/wiki/Java:String.codePointAt()" title="codePointAt()">.codePointAt()</a>.</p>
<p>El método <a href="http://www.w3api.com/wiki/Java:String.codePointAt()" title="codePointAt()">.codePointAt()</a> devuelve el código ASCII de un carácter en concreto. El carácter será el que coincida con el índice que se pasa como parámetro al método.</p>
<p>Empezamos definiendo la cadena:</p>
<pre class="java"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://w3api.com/wiki/Java:String"><span style="color: #aaaadd; font-weight: bold;">String</span></a> sCadena = <span style="color: #ff0000;">&quot;Esto es una cadena de texto&quot;</span>;</div></li></ol></pre>
<p>Ahora empezamos recorriendo la cadena, para ello nos apoyamos en un bucle for y en el método <a href="http://www.w3api.com/wiki/Java:String.length()">.length()</a>, el cual nos ayuda a conocer el tamaño de la cadena. En el interior del bucle, y apoyándonos en el elemento de interacción vamos obteniendo el código ASCII de los caracteres con el método <a href="http://www.w3api.com/wiki/Java:String.codePointAt()" title="codePointAt()">.codePointAt()</a></p>
<pre class="java"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #993333;">int</span> x=<span style="color: #cc66cc;">0</span>;x&lt;sCadena.<span style="color: #006600;">length</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;x++<span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">  <a href="http://w3api.com/wiki/Java:System"><span style="color: #aaaadd; font-weight: bold;">System</span></a>.<span style="color: #006600;">out</span>.<span style="color: #006600;">println</span><span style="color: #66cc66;">&#40;</span>sCadena.<span style="color: #006600;">charAt</span><span style="color: #66cc66;">&#40;</span>x<span style="color: #66cc66;">&#41;</span> + <span style="color: #ff0000;">&quot; = &quot;</span> + sCadena.<span style="color: #006600;">codePointAt</span><span style="color: #66cc66;">&#40;</span>x<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;;</div></li></ol></pre>
<p>Vemos que utilizamos el método <a href="http://www.w3api.com/wiki/Java:String.charAt()" title="charAt()">.charAt()</a> para sacar el carácter asociado al código ASCII.<strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://lineadecodigo.com/java/invertir-una-cadena-con-java/" rel="bookmark" title="Agosto 25, 2007">Invertir una cadena con Java</a></li>
<li><a href="http://lineadecodigo.com/java/listar-caracteres-de-una-cadena-con-java/" rel="bookmark" title="Octubre 17, 2007">Listar caracteres de una cadena con Java</a></li>
<li><a href="http://lineadecodigo.com/java/saber-si-una-palabra-es-un-palindromo-con-java/" rel="bookmark" title="Septiembre 19, 2007">Saber si una palabra es un palíndromo con Java</a></li>
<li><a href="http://lineadecodigo.com/java/obtener-un-caracter-de-una-cadena-con-java/" rel="bookmark" title="Enero 5, 2010">Obtener un carácter de una cadena con Java</a></li>
<li><a href="http://lineadecodigo.com/java/tamano-de-una-cadena-en-java/" rel="bookmark" title="Diciembre 13, 2006">Tamaño de una cadena en Java</a></li>
</ul>
<p><!-- Similar Posts took 6.211 ms --></p>

<p><a href="http://feedads.g.doubleclick.net/~a/ylLJFDxuawW7b9uaT0CCqNZhn0M/0/da"><img src="http://feedads.g.doubleclick.net/~a/ylLJFDxuawW7b9uaT0CCqNZhn0M/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/ylLJFDxuawW7b9uaT0CCqNZhn0M/1/da"><img src="http://feedads.g.doubleclick.net/~a/ylLJFDxuawW7b9uaT0CCqNZhn0M/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=KH13N-x96Uo:6EQaHDOHZRY:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=KH13N-x96Uo:6EQaHDOHZRY:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?i=KH13N-x96Uo:6EQaHDOHZRY:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=KH13N-x96Uo:6EQaHDOHZRY:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?i=KH13N-x96Uo:6EQaHDOHZRY:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=KH13N-x96Uo:6EQaHDOHZRY:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=KH13N-x96Uo:6EQaHDOHZRY:tKBiNdHYW3c"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=tKBiNdHYW3c" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LineaDeCodigo/~4/KH13N-x96Uo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://lineadecodigo.com/java/obtener-los-codigos-ascii-de-una-cadena-de-texto/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://lineadecodigo.com/java/obtener-los-codigos-ascii-de-una-cadena-de-texto/</feedburner:origLink></item>
		<item>
		<title>Peticiones AJAX con jQuery</title>
		<link>http://feedproxy.google.com/~r/LineaDeCodigo/~3/EIT_lYq4vps/</link>
		<comments>http://lineadecodigo.com/jquery/peticiones-ajax-con-jquery/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 07:00:07 +0000</pubDate>
		<dc:creator>lineadecodigo</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[button]]></category>
		<category><![CDATA[callback]]></category>
		<category><![CDATA[click]]></category>
		<category><![CDATA[DIV]]></category>
		<category><![CDATA[GET]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[onClick]]></category>
		<category><![CDATA[ready]]></category>

		<guid isPermaLink="false">http://lineadecodigo.com/?p=2195</guid>
		<description><![CDATA[Las bondades del patrón AJAX son más que conocidas... La posibilidad de hacer peticiones de forma asíncrona que actualicen una parte de la página es una realidad de muchas webs. jQuery, como framework de JavaScript nos permite realizar esta tarea de forma sencilla, evitando codificar directamente la petición AJAX en JavaScript.
En este caso vamos a [...]]]></description>
			<content:encoded><![CDATA[<p>Las bondades del patrón <a href="http://www.manualweb.net/tutorial-ajax/" title="AJAX">AJAX</a> son más que conocidas... La posibilidad de hacer peticiones de forma asíncrona que actualicen una parte de la página es una realidad de muchas webs. <a href="http://www.manualweb.net/tutorial-jquery/" title="jQuery">jQuery</a>, como framework de <a href="http://www.manualweb.net/tutorial-javascript/" title="javascript">JavaScript</a> nos permite realizar esta tarea de forma sencilla, evitando codificar directamente la petición <a href="http://www.manualweb.net/tutorial-ajax/" title="AJAX">AJAX</a> en <a href="http://www.manualweb.net/tutorial-javascript/" title="javascript">JavaScript</a>.</p>
<p>En este caso vamos a realizar una petición a una página para que nos devuelva un contenido, el cual incluiremos en una capa de nuestra página.</p>
<p>Así, lo primero será montar nuestra página <a href="http://www.manualweb.net/tutorial-html/" title="HTML">HTML</a>. Con su <a href="http://w3api.com/wiki/HTML:BUTTON" title="button">button</a> y su <a href="http://w3api.com/wiki/HTML:DIV" title="div">div</a>.</p>
<pre class="html4strict"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #00bbdd;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot; &quot;http://www.w3.org/TR/html4/loose.dtd&quot;&gt;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://w3api.com/wiki/HTML:html"><span style="color: #000000; font-weight: bold;">&lt;html&gt;</span></a></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://w3api.com/wiki/HTML:head"><span style="color: #000000; font-weight: bold;">&lt;head&gt;</span></a></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://w3api.com/wiki/HTML:meta"><span style="color: #000000; font-weight: bold;">&lt;meta</span></a> <span style="color: #000066;">http-equiv</span>=<span style="color: #ff0000;">&quot;Content-Type&quot;</span> <span style="color: #000066;">content</span>=<span style="color: #ff0000;">&quot;text/html; charset=ISO-8859-1&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://w3api.com/wiki/HTML:<span style="color: #000066;">title</span>"><span style="color: #000000; font-weight: bold;">&lt;title&gt;</span></a></span>Petición AJAX con jQuery<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/title&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/head&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://w3api.com/wiki/HTML:body"><span style="color: #000000; font-weight: bold;">&lt;body&gt;</span></a></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://w3api.com/wiki/HTML:h1"><span style="color: #000000; font-weight: bold;">&lt;h1&gt;</span></a></span>Petición AJAX con jQuery<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/h1&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://w3api.com/wiki/HTML:div"><span style="color: #000000; font-weight: bold;">&lt;div</span></a> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;mensaje&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://w3api.com/wiki/HTML:button"><span style="color: #000000; font-weight: bold;">&lt;button</span></a> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;cargar&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Cargar<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/button&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/body&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/html&gt;</span></span></div></li></ol></pre>
<p>Lo siguiente será inicializar <a href="http://www.manualweb.net/tutorial-jquery/" title="jQuery">jQuery</a> y empezar a generar el código no intrusivo. Cargamos la librería <a href="http://www.manualweb.net/tutorial-jquery/" title="jQuery">jQuery</a> mediante la etiqueta <a href="http://w3api.com/wiki/HTML:SCRIPT" title="script">SCRIPT</a>.</p>
<pre class="html4strict"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://w3api.com/wiki/HTML:script"><span style="color: #000000; font-weight: bold;">&lt;script</span></a> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;jquery.js&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/script&gt;</span></span></div></li></ol></pre>
<p>Una vez configurado todo... vamos a resolver el tema en cuestión. Lo primero será capturar el <a href="http://w3api.com/wiki/HTML:Onclick" title="onClick">onClick</a> sobre el botón. Para ello, sobre el <a href="http://w3api.com/wiki/HTML:Id" title="id">ID</a> cargar asociamos la función <a href="http://w3api.com/wiki/jQuery:Click()" title="click()">click()</a>.</p>
<pre class="javascript"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;script type=<span style="color: #3366CC;">&quot;text/javascript&quot;</span>&gt;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span>document<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">ready</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;#cargar&quot;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">click</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">    <span style="color: #009900; font-style: italic;">// Petición AJAX </span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/script&gt;</div></li></ol></pre>
<p>Para hacer la petición <a href="http://www.manualweb.net/tutorial-ajax/" title="AJAX">AJAX</a> nos apoyaremos en la función <a href="http://w3api.com/wiki/jQuery:Get()" title="get()">.get(url,[data],[callback],[type])</a>. Esta función es muy sencilla y sus parámetros se descomponen en:</p>
<ul>
<li><strong>url</strong>, es la URL que contendrá el fichero que nos devuelva los datos.</li>
<li><strong>data</strong>, son los datos a enviar a la URl de petición</li>
<li><strong>callback</strong>, es el método que se ejecutará cuando se realice la petición</li>
<li><strong>type</strong>, tipo de datos que se devolverán desde el servidor: text, xml, html, json,...</li>
</ul>
<p>Así la petición <a href="http://www.manualweb.net/tutorial-ajax/" title="AJAX">AJAX</a> será:</p>
<pre class="javascript"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$.<span style="color: #006600;">get</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;http://lineadecodigo.com/samples/datos.php&quot;</span>, <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>data<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">  $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;#mensaje&quot;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">html</span><span style="color: #66cc66;">&#40;</span>data<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div></li></ol></pre>
<p>En ella se puede apreciar varias cosas. La primera que datos.php es el fichero que devuelve los datos (no entraremos en detalle de como se compone, pero básicamente devuelve código <a href="http://www.manualweb.net/tutorial-html/" title="HTML">HTML</a>). La segunda es que la función de callback recibe como parámetro los datos devueltos por el servidor... dentro de esta función lo que estamos haciendo es añadir estos datos a la capa mediante el método <a href="http://w3api.com/wiki/jQuery:Html()" title="html()">.html()</a></p>
<p>Ahora solo nos queda el explotar las posibilidades del método <a href="http://w3api.com/wiki/jQuery:Get()" title="get()">.get()</a> para dar potencia a nuestra web mediante peticiones <a href="http://www.manualweb.net/tutorial-ajax/" title="AJAX">AJAX</a> con <a href="http://www.manualweb.net/tutorial-jquery/" title="jQuery">jQuery</a>.<strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://lineadecodigo.com/jquery/repaginar-con-jquery-y-ajax/" rel="bookmark" title="Febrero 1, 2010">Repaginar con jQuery y AJAX</a></li>
<li><a href="http://lineadecodigo.com/jquery/cargar-un-fichero-con-jquery/" rel="bookmark" title="Enero 25, 2009">Cargar un fichero con jQuery</a></li>
<li><a href="http://lineadecodigo.com/jquery/hola-mundo-con-jquery/" rel="bookmark" title="Enero 23, 2009">Hola Mundo con jQuery</a></li>
<li><a href="http://lineadecodigo.com/jquery/modificar-el-estilo-con-jquery/" rel="bookmark" title="Enero 24, 2009">Modificar el estilo con jQuery</a></li>
<li><a href="http://lineadecodigo.com/jquery/ocultar-y-mostrar-elementos-con-jquery/" rel="bookmark" title="Febrero 5, 2009">Ocultar y mostrar elementos con jQuery</a></li>
</ul>
<p><!-- Similar Posts took 36.897 ms --></p>

<p><a href="http://feedads.g.doubleclick.net/~a/9RHznM1YTrNSmQDQjfvDx_IGpGI/0/da"><img src="http://feedads.g.doubleclick.net/~a/9RHznM1YTrNSmQDQjfvDx_IGpGI/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/9RHznM1YTrNSmQDQjfvDx_IGpGI/1/da"><img src="http://feedads.g.doubleclick.net/~a/9RHznM1YTrNSmQDQjfvDx_IGpGI/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=EIT_lYq4vps:_OZrTFEZBq8:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=EIT_lYq4vps:_OZrTFEZBq8:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?i=EIT_lYq4vps:_OZrTFEZBq8:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=EIT_lYq4vps:_OZrTFEZBq8:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?i=EIT_lYq4vps:_OZrTFEZBq8:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=EIT_lYq4vps:_OZrTFEZBq8:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=EIT_lYq4vps:_OZrTFEZBq8:tKBiNdHYW3c"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=tKBiNdHYW3c" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LineaDeCodigo/~4/EIT_lYq4vps" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://lineadecodigo.com/jquery/peticiones-ajax-con-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://lineadecodigo.com/jquery/peticiones-ajax-con-jquery/</feedburner:origLink></item>
		<item>
		<title>Obtener un carácter de una cadena con Java</title>
		<link>http://feedproxy.google.com/~r/LineaDeCodigo/~3/JDH_C-DWXME/</link>
		<comments>http://lineadecodigo.com/java/obtener-un-caracter-de-una-cadena-con-java/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 07:00:44 +0000</pubDate>
		<dc:creator>lineadecodigo</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[charAt]]></category>
		<category><![CDATA[String]]></category>

		<guid isPermaLink="false">http://lineadecodigo.com/?p=2187</guid>
		<description><![CDATA[Si queremos obtener un carácter de una cadena con Java, simplemente tenemos que utilizar el método .charAt() sobre la misma cadena.
De esa manera, lo primero será definir la cadena:
String sCadena = &#34;Esto es una cadena de texto&#34;;
Ahora tenemos que saber que los caracteres empiezan a enumerarse por el 0. Es por ello que si queremos [...]]]></description>
			<content:encoded><![CDATA[<p>Si queremos obtener un carácter de una cadena con <a href="http://www.manualweb.net/tutorial-java/" title="Java">Java</a>, simplemente tenemos que utilizar el método <a href="http://www.w3api.com/wiki/Java:String.charAt()" title="charAt">.charAt()</a> sobre la misma cadena.</p>
<p>De esa manera, lo primero será definir la cadena:</p>
<pre class="java"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://w3api.com/wiki/Java:String"><span style="color: #aaaadd; font-weight: bold;">String</span></a> sCadena = <span style="color: #ff0000;">&quot;Esto es una cadena de texto&quot;</span>;</div></li></ol></pre>
<p>Ahora tenemos que saber que los caracteres empiezan a enumerarse por el 0. Es por ello que si queremos obtener el primer carácter tenemos que solicitar el 0, y si queremos el carácter 'e' de la palabra 'es', este será el quinto carácter.</p>
<p>De esta manera el código <a href="http://www.manualweb.net/tutorial-java/" title="Java">Java</a> con el método <a href="http://www.w3api.com/wiki/Java:String.charAt()" title="charAt">.charAt()</a> se queda de la siguiente forma:</p>
<pre class="java"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://w3api.com/wiki/Java:System"><span style="color: #aaaadd; font-weight: bold;">System</span></a>.<span style="color: #006600;">out</span>.<span style="color: #006600;">println</span><span style="color: #66cc66;">&#40;</span>sCadena.<span style="color: #006600;">charAt</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div></li></ol></pre>
<p><strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://lineadecodigo.com/java/listar-caracteres-de-una-cadena-con-java/" rel="bookmark" title="Octubre 17, 2007">Listar caracteres de una cadena con Java</a></li>
<li><a href="http://lineadecodigo.com/java/invertir-una-cadena-con-java/" rel="bookmark" title="Agosto 25, 2007">Invertir una cadena con Java</a></li>
<li><a href="http://lineadecodigo.com/java/saber-si-una-palabra-es-un-palindromo-con-java/" rel="bookmark" title="Septiembre 19, 2007">Saber si una palabra es un palíndromo con Java</a></li>
<li><a href="http://lineadecodigo.com/java/java-y-la-palabra-mas-larga-de-una-frase/" rel="bookmark" title="Agosto 26, 2007">Java y la palabra más larga de una frase</a></li>
<li><a href="http://lineadecodigo.com/java/obtener-los-codigos-ascii-de-una-cadena-de-texto/" rel="bookmark" title="Enero 7, 2010">Obtener los códigos ASCII de una cadena de texto</a></li>
</ul>
<p><!-- Similar Posts took 61.830 ms --></p>

<p><a href="http://feedads.g.doubleclick.net/~a/sU0EBEryUAu7wlHjRx0h4m_EVng/0/da"><img src="http://feedads.g.doubleclick.net/~a/sU0EBEryUAu7wlHjRx0h4m_EVng/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/sU0EBEryUAu7wlHjRx0h4m_EVng/1/da"><img src="http://feedads.g.doubleclick.net/~a/sU0EBEryUAu7wlHjRx0h4m_EVng/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=JDH_C-DWXME:sDjtstffcko:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=JDH_C-DWXME:sDjtstffcko:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?i=JDH_C-DWXME:sDjtstffcko:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=JDH_C-DWXME:sDjtstffcko:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?i=JDH_C-DWXME:sDjtstffcko:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=JDH_C-DWXME:sDjtstffcko:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=JDH_C-DWXME:sDjtstffcko:tKBiNdHYW3c"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=tKBiNdHYW3c" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LineaDeCodigo/~4/JDH_C-DWXME" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://lineadecodigo.com/java/obtener-un-caracter-de-una-cadena-con-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://lineadecodigo.com/java/obtener-un-caracter-de-una-cadena-con-java/</feedburner:origLink></item>
		<item>
		<title>Ordenando alfabéticamente con CASE_INSENSITIVE_ORDER</title>
		<link>http://feedproxy.google.com/~r/LineaDeCodigo/~3/S41j9On4qvg/</link>
		<comments>http://lineadecodigo.com/java/ordenando-alfabeticamente-con-case_insensitive_order/#comments</comments>
		<pubDate>Mon, 04 Jan 2010 07:00:40 +0000</pubDate>
		<dc:creator>lineadecodigo</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[CASE_INSENSITIVE_ORDER]]></category>
		<category><![CDATA[sort]]></category>
		<category><![CDATA[String]]></category>
		<category><![CDATA[vector]]></category>

		<guid isPermaLink="false">http://lineadecodigo.com/?p=2182</guid>
		<description><![CDATA[En el artículo sobre cómo ordenar un vector de forma alfabética con Java veíamos como implementar un comparador alfabético utilizando el interface Comparator.
Esto lo podemos realizar de otra forma mediante el campo CASE_INSENSITIVE_ORDER de la clase String. Este campo nos permite realizar ordenaciones que ignoren las mayúsculas.
Lo primero, el declarar el Vector e insertarle elementos:
Vector&#60;String&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>En el artículo sobre cómo <a href="http://lineadecodigo.com/java/ordenar-un-vector-de-forma-alfabetica-con-java/" title="ordenar un vector de forma alfabética con Java">ordenar un vector de forma alfabética con Java</a> veíamos como implementar un comparador alfabético utilizando el interface <a href="http://www.w3api.com/wiki/Java:Comparator" title="Comparator">Comparator</a>.</p>
<p>Esto lo podemos realizar de otra forma mediante el campo <a href="http://www.w3api.com/wiki/Java:String.CASE_INSENSITIVE_ORDER" title="CASE_INSENSITIVE_ORDER">CASE_INSENSITIVE_ORDER</a> de la clase <a href="http://www.w3api.com/wiki/Java:String" title="String">String</a>. Este campo nos permite realizar ordenaciones que ignoren las mayúsculas.</p>
<p>Lo primero, el declarar el <a href="http://www.w3api.com/wiki/Java:Vector" title="Vector">Vector</a> e insertarle elementos:</p>
<pre class="java"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Vector&lt;String&gt; miVector = <span style="color: #000000; font-weight: bold;">new</span> Vector&lt;String&gt;<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">miVector.<span style="color: #006600;">add</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Victor&quot;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">miVector.<span style="color: #006600;">add</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;julio&quot;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">miVector.<span style="color: #006600;">add</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;amaya&quot;</span><span style="color: #66cc66;">&#41;</span>;</div></li></ol></pre>
<p>Ahora ejecutamos la ordenación mediante el método <a href="http://www.w3api.com/wiki/Java:Collections.sort()" title="sort()">.sort()</a>. El segundo parámetro será la forma de ordenación, el campo <a href="http://www.w3api.com/wiki/Java:String.CASE_INSENSITIVE_ORDER" title="CASE_INSENSITIVE_ORDER">CASE_INSENSITIVE_ORDER</a>.</p>
<pre class="java"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://w3api.com/wiki/Java:Collections"><span style="color: #aaaadd; font-weight: bold;">Collections</span></a>.<span style="color: #006600;">sort</span><span style="color: #66cc66;">&#40;</span>miVector,<a href="http://w3api.com/wiki/Java:String"><span style="color: #aaaadd; font-weight: bold;">String</span></a>.<span style="color: #006600;">CASE_INSENSITIVE_ORDER</span><span style="color: #66cc66;">&#41;</span>;</div></li></ol></pre>
<p>Ya solo nos quedará el volcar el contenido por pantalla.</p>
<pre class="java"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><a href="http://w3api.com/wiki/Java:String"><span style="color: #aaaadd; font-weight: bold;">String</span></a> sElemento: miVector<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">  <a href="http://w3api.com/wiki/Java:System"><span style="color: #aaaadd; font-weight: bold;">System</span></a>.<span style="color: #006600;">out</span>.<span style="color: #006600;">println</span><span style="color: #66cc66;">&#40;</span>sElemento<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li></ol></pre>
<p><strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://lineadecodigo.com/java/ordenar-un-vector-de-string-en-java/" rel="bookmark" title="Marzo 22, 2009">Ordenar un Vector de String en Java</a></li>
<li><a href="http://lineadecodigo.com/java/ordenar-un-vector-de-forma-alfabetica-con-java/" rel="bookmark" title="Marzo 25, 2009">Ordenar un Vector de forma alfabética con Java</a></li>
<li><a href="http://lineadecodigo.com/java/insertar-elementos-en-un-vector/" rel="bookmark" title="Diciembre 17, 2006">Insertar elementos en un Vector</a></li>
<li><a href="http://lineadecodigo.com/java/insertar-un-elemento-en-una-posicion-concreta-del-vector/" rel="bookmark" title="Enero 19, 2009">Insertar un elemento en una posición concreta del Vector</a></li>
<li><a href="http://lineadecodigo.com/java/listar-un-conjunto/" rel="bookmark" title="Agosto 3, 2007">Listar un conjunto</a></li>
</ul>
<p><!-- Similar Posts took 6.403 ms --></p>

<p><a href="http://feedads.g.doubleclick.net/~a/8W5xSS4WMYbFrDYZEvwtrvFcO6w/0/da"><img src="http://feedads.g.doubleclick.net/~a/8W5xSS4WMYbFrDYZEvwtrvFcO6w/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/8W5xSS4WMYbFrDYZEvwtrvFcO6w/1/da"><img src="http://feedads.g.doubleclick.net/~a/8W5xSS4WMYbFrDYZEvwtrvFcO6w/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=S41j9On4qvg:DVNupN4xR70:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=S41j9On4qvg:DVNupN4xR70:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?i=S41j9On4qvg:DVNupN4xR70:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=S41j9On4qvg:DVNupN4xR70:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?i=S41j9On4qvg:DVNupN4xR70:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=S41j9On4qvg:DVNupN4xR70:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LineaDeCodigo?a=S41j9On4qvg:DVNupN4xR70:tKBiNdHYW3c"><img src="http://feeds.feedburner.com/~ff/LineaDeCodigo?d=tKBiNdHYW3c" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LineaDeCodigo/~4/S41j9On4qvg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://lineadecodigo.com/java/ordenando-alfabeticamente-con-case_insensitive_order/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://lineadecodigo.com/java/ordenando-alfabeticamente-con-case_insensitive_order/</feedburner:origLink></item>
	</channel>
</rss><!-- Dynamic page generated in 2.720 seconds. --><!-- Cached page generated by WP-Super-Cache on 2010-03-20 13:55:23 -->
