function Submit(){
var name1=document.getElementById('name1').value;
var name2=document.getElementById('name2').value;
var input=document.getElementById('input');
if(!name1 && !name2) { return alert("plz write all inputs"); }
return input.innerHTML=name1+""+name2;
}
///////////////////////
<form action="" onsubmit="FA(this.name);return false;" method="post" name="set_from" id="fuck" />
<input autocomplete="off" type="text" name="numb0" id="name" size="25" />
<input autocomplete="off" type="text" name="numb1" id="name1" size="25" />
<input autocomplete="off" type="text" name="numb2" id="name2" size="25" />
<select name="date">
<option value="0" selected="selected"> - Выберите -</option>
<option value="1">1</option>
<option value="2">2</option>
</select>
<textarea name="text" ></textarea>
<input type="submit" value="ОК" />
</form>
<span id="paste"></span>
//////////////////
function FA(){
var len=document.set_from.elements.length-1; //length-1, потому что кнопка считается за элемент и мы ее отбрасываем.
var mas=[]; // создаем массив к торый собственно и будем заполнять
var paste=document.getElementById('paste');
for(var i=0;i<len;i++){
var val=document.set_from.elements[i].value;
if (val!=0 && val!=undefined && val!=null){ // дабы не забивать массив не определенными значениями мы делаем проверку на передаваемое значение;
mas.push(val); // работаем с массивом как со стеком
}
}
paste.innerHTML=mas; // ну и вывод массива
}
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.