Nová ukázka
Reset
Načíst z URL
Uložit a získat odkaz
Vztahuje se k…
Nevyplňujte
Napiště „nejsem robot“
▶
Přepnout zobrazení
Výsledek
<form onsubmit="return formSubmited(this, 'result');" name="formular"> <input class="text2" type="date" name="bday" value="2015-11-11"> <textarea class="text2" name="promenna" cols="40" rows="3"> koment</textarea> <input type="submit" value="Zobrazit"> </form> <div id="result">... zde bude výsledek</div>
HTML
Autoformát
Standardní režim
Mobilní zobrazení
input, textarea { display: block; margin-bottom: 0.5em; } #result { margin-top: 2em; padding: 1em; white-space: pre; border: 2px dashed #aa22FF; display: inline-block; }
CSS
Autoformát
CSS reset
Až na konci
function formSubmited(form, destination) { var content = "<AddComment>Text komentáře</AddComment>\n<Seznam>\n"; for (var i = 0; i < form.length; i++) { if (form[i].type !== "submit") content += " <polozka>\n\ <Name>"+form[i].name+"</Name>\n\ <Value>"+form[i].value+"</Value>\n\ </polozka>\n"; } content += "</Seznam>"; var destinationElement = document.getElementById(destination); while (destinationElement.firstChild) { destinationElement.removeChild(destinationElement.firstChild); } destinationElement.appendChild(document.createTextNode(content)); return false; }
J
ava
S
cript
Autoformát
jQuery
Umístění JS
window.onload
</head>
</body>