Código Javascript:
Ver original
<script type="text/javascript"> var color = document.getElementById('color'); var colorAct = color.options[color.selectedIndex].value; var fondo = document.getElementById('fondo'); var fondoAct = fondo.options[fondo.selectedIndex].value; var tamano = document.getElementById('tamano'); var tamanoAct = tamano.options[tamano.selectedIndex].value; var texto = document.getElementById('texto').value; var final = document.getElementById('textoFinal'); var vistaPrevia = document.getElementById('vistaPrevia'); var previo = document.getElementById('previa'); function edit(){ final.innerHTML = '<span style="color:' + color + '; background-color:' + fondo + '; font-size:' + tamano +';">' + texto + '</span>'; } function previa(){ vistaPrevia.innerHTML = '<span style="color:' + color + '; background-color:' + fondo + '; font-size:' + tamano +';">' + texto + '</span>'; if(previo.checked==true){ vistaPrevia.style.display = 'block'; }else{ vistaPrevia.style.display = 'none'; } } </script>
Código HTML:
Ver original
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> </head> <body> <form id='miForm' action='' method='post'> Color:<br /> <select id='color' onchange="previa();"> </select> Fondo:<br /> <select id='fondo' onchange="previa();"> </select> <select id='tamano' onchange="previa();"> </select> <input type="checkbox" id='previa' onclick='previa();' />Vista previa <input type="button" value="Obtener texto" onclick='edit();' /> </form> </body> </html>
Saludos (: