1
C, C++, C#, Java, Visual Basic, HTML, PHP, CSS, Javascript, Ajax, Joomla, MySql y más / Re:Duda generador de JavaScript
« en: 25 de Enero 2015, 22:00 »
Muchas gracias, lo revisaré
![Gui�ar ;)](https://aprenderaprogramar.com/foros/Smileys/default/wink.gif)
Si tienes algún problema para registrarte en el foro o para escribir mensajes ponte en contacto con nosotros a través del formulario de contacto de aprenderaprogramar.com
Esta sección te permite ver todos los posts escritos por este usuario. Ten en cuenta que sólo puedes ver los posts escritos en zonas a las que tienes acceso en este momento.
function generateCode(form){
//Datos del libro
portada = document.inputForm.portada.value;
title = document.inputForm.title.value;
serie = document.inputForm.serie.value;
autor = document.inputForm.autor.value;
sinopsis = document.inputForm.sinopsis.value;
output =
'<div class="block">\n'
'<a href="' + portada + '" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="' + portada + '" height="320" width="212" /></a></div>\n\n'
'<span style="font-weight: bold;">Título:</span> ' + title + '\n'
'<span style="font-weight: bold;">Serie:</span> ' + serie + '\n'
'<span style="font-weight: bold;">Autor:</span> ' + autor + '\n\n'
'<blockquote class="tr_bq">\n'
' + sinopsis + ''</blockquote>\n'
'<div style="font-family: georgia; font-size: 30px; font-weight: bold; letter-spacing: 3px; margin-bottom: -10px; text-align: center; text-shadow: 2px 2px 0px #BBB;">\n'
'OPINIÓN</div>\n\'
'ESCRIBE AQUÍ TU RESEÑA ÑAJSDALSDJF\n';
document.inputForm.source.value = output;
return output;
}
function preview() {
var htmlCode;
htmlCode = generateCode();
targetURL = "/preview/preview.cfm?htmlCode=" + htmlCode;
window.open(targetURL, "newWindow", "width=500,height=400,top=100,left=100,toolbar=no,menubar=no,location=no,scrollbars=yes");
}
<div class="code-generator">
<form name="inputForm" id="inputForm">
<fieldset>
<legend>Datos del libro</legend>
<div>
<label for="portada" title="Enlace Portada">Enlace de la portada:</label><br />
<input name="portada" id="portada" type="input" size="30" value="http://" />
</div>
<div>
<label for="title" title="Título del libro">Título del libro:</label><br />
<input name="title" id="title" type="input" maxlength="100" size="30" value="Escribe aquí..." />
</div>
<div>
<label for="serie" title="Nombre de la serie si la hay">Nombre de la serie si tiene:</label><br />
<textarea name="serie" id="serie" cols="30" rows="3">Si es libro único no pongas nada aquí...</textarea>
</div>
<div>
<label for="autor" title="Nombre autor/autora">Autor/a:</label><br />
<textarea name="autor" id="autor" cols="30" rows="3">....</textarea>
</div>
<div>
<label for="sinopsis" title="sinopsis">Sinopsis:</label><br />
<textarea name="sinopsis" id="sinopsis" cols="70" rows="4">....</textarea>
</div>
</fieldset>
<fieldset>
<legend>Generated HTML Code</legend>
<div>
<input type="button" value="Generate HTML Code!" onClick="javascript:generateCode();"> OR <input type="button" value="Generate HTML Code and Preview!" onClick="javascript:preview();">
</div>
<div>
<p>Copy and paste the following code into a text file and save with a .html or .htm extension.</p>
<textarea name="source" rows="7" cols="40" onclick="this.focus();this.select()"></textarea>
</div>
</fieldset>
</form>
</div>
Sobre la educación, sólo puedo decir que es el tema más importante en el que nosotros, como pueblo, debemos involucrarnos.
Abraham Lincoln (1808-1865) Presidente estadounidense.
aprenderaprogramar.com: Desde 2006 comprometidos con la didáctica y divulgación de la programación