Jump to content

checked=true only for few sec.


Matej
 Share

Recommended Posts

Hello gentlemen , i have script , that when i click on button , it should turn checkboxes on value true , but it does it only for like 1sec and it turns it back to false . Can someone help me with that please,:)

script

 

<!DOCTYPE html><html><body><form name="lol"><input type="submit" name="jedna" onclick="mouse(jedna)" value="klikjedna" /><input type="submit" name="dva"   value="klikdva" onclick="mouse(dva)"/><input type="submit" name="tri"   value="kliktri" onclick="mouse(tri)"/></br><input type="checkbox" name="matej" value="syr" id="polovnik"/>Syr </br><input type="checkbox" name="matej" value="sunka"/>sunka</br><input type="checkbox" name="matej" value="ananas"/>Ananas</br><input type="checkbox" name="matej" value="tuniak"/>Tuniak</br><p> velkosti:</br><input type="radio" name="marek" value="Mala">Mala</br><input type="radio" name="marek" value="Velka">Velka</br<</p></br><input type="button" name="swag" onclick="Matula()" value="klikni"/></form>   <script type="text/javascript">function Matula(){ var x=document.getElementsByTagName("body")[0];  var y=document.createElement("p");  var g=document.createTextNode("Vasa pizza bude obsahovat:");y.appendChild(g); x.appendChild(y);var swag=document.forms["lol"].matej.length; for(var i=0;i<document.forms["lol"].matej.length;i++){if(document.forms["lol"].matej[i].checked) { var torko=document.getElementsByTagName("body")[0];var q=document.createElement("p"); var w=document.createTextNode(document.forms["lol"].matej[i].value); q.appendChild(w); torko.appendChild(q);}} var m=document.forms["lol"].marek.length;for(c=0;c<m;c++){if(document.forms["lol"].marek[c].checked){var n=document.getElementsByTagName("body")[0]; var b=document.createElement("p"); var k=document.createTextNode("Veľkosť je:" +document.forms["lol"].marek[c].value); b.appendChild(k); n.appendChild(;}}};    </script><script>function mouse(p){ if(p.value=="klikjedna"){for(var u=0;u<document.forms["lol"].matej.length;u++){document.forms["lol"].matej[u].checked=true};} else if (p.value=="klikdva"){document.getElementById("polovnik").checked=true} else if(p.value=="kliktri"){alert("serus");}}</script></body></html>
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...