Jump to content

Matej

Members
  • Posts

    185
  • Joined

  • Last visited

Everything posted by Matej

  1. Matej

    js book

    Hello gentlemen , i decided to buy some book about js. I have made some research and im interessted in this book : http://www.amazon.com/Professional-JavaScript-Developers-Nicholas-Zakas/dp/1118026691/ref=sr_1_1?s=books&ie=UTF8&qid=1401358411&sr=1-1&keywords=javascript+for+professionals , but i'd like to know your suggestions/opinion. Thanks for answers and have a nice day.
  2. Matej

    auto adjusting web

    I'd like to adjust my website to suit a users screen resolution.
  3. Matej

    auto adjusting web

    Hello gentlemen , i'd like to make auto-adjusting web(on resize). i was trying to do html,body{width:100%;heigth:100%} also triedbody html{max-width:100%;min-width:20%} but its not working , can someone advise me?
  4. Matej

    rollovers

    Hello gentlemen , i have html code <img src="pic1" id="hi" onmouseover="procko(this,'somepicture.jpg')" onmouseout="procko(this,'pic1.')"/><img src="pic2" id="hello" onmouseover="procko(this,'somepicture2.jpg')" onmouseout="procko(this,'pic2.')"/> and js code function procko(x, y) { var g = document.getElementsByTagName("img"); for (var i = 0; i < g.length; i++) { if (g[i].id.match("hi")) { x.src = y; } }} i want it , to invoke the function on mouseover , only when id match("hi") but the function is invoked on both pictures. Can someone explain why please? (it writes"Cannot read property 'match' of undefined ") Thanks for answers , and have a nice day.
  5. Matej

    Cookie explain

    Thanks! and last question if i set var g=x.children g becomes array right?
  6. Matej

    Cookie explain

    So for(var i=0; i<ca.length; i++) { var c = ca[i].trim(); im setting C and C isnt array so i dont use index and Array.prototype.myUcase = function() { for (i = 0; i < this.length; i++) { this[i] = this[i].toUpperCase(); }} this reffer to array so i need to put , did i get it right? and if i would use for example c=ca[i].split("=") (in loop) i would have to use c eventually, bcs c would became array right? // And basicly when im using var c = ca[i].trim(); C isnt becoming an ArrayThanks for answers
  7. Matej

    Cookie explain

    Thanks , i undesrtood that example with prototype , i was (and im still quite ) confused if i should use c=blabla.method() or c=blabla.method() But if i get it right , when im working with arrays and collections , there has to be , if i use "this"
  8. Matej

    Cookie explain

    http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_prototype_array
  9. Matej

    Cookie explain

    What do you mean as collections? Objects?
  10. Matej

    Cookie explain

    So there always have to be , when i wanan use this=bla bla ?
  11. Matej

    Cookie explain

    One more question , why is there var c = ca[i].trim();? and here this[i]=this[i].toUpperCase() isthere " this" and not just "this"?(Its the example from w3schools)
  12. Matej

    Cookie explain

    Thanks for advice
  13. Matej

    Cookie explain

    Thanks for answers sirs , so if i get it right : 1) we have cookie name , for example "Cheese" , so basicly "Cheese=somevalue".(we have another like ;expire=date and so on) 2) we set cname to "Cheese" 3)we set cookies to new Array , (so Array[0]="Cheese=someovalue" , Array[1]="expire=date" and so on) 4)we set "var c" to loop throught Array , and delete space in front of and behind Array[0] etc. value 5)and if for example "c.indexOf(name)==0" so if "Cheese=somevalue".instanceOf(Cheese)==0 it return "Cheese=Somevalue.substring(name.length(7),c.length(2)) , also why cant it be ca.length? Thanks for answers
  14. Hi , i recently found this code function getCookie(cname){var name = cname + "=";var ca = document.cookie.split(';');for(var i=0; i<ca.length; i++) { var c = ca[i].trim(); if (c.indexOf(name)==0) return c.substring(name.length,c.length); }return "";} If i get it right var c is now array which consist of elements in array "ca" but with space removed (basicly c=c). also can someone explain to me what is "name" in "c.indexOf(name)==0)" where did i deffine it? will i deffine it by apling function? Thanks for answering quite stupid question.
  15. 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>
  16. Matej

    ID/Name

    Well can you please explain why this doesnt work http://jsfiddle.net/35fQG/1/ (couldnt use forms) and this does function nastav(typ) { if (typ.value == "Zeleninový speciál") { document.forms["pizzaFormular"].druh.value = "zelenina"; } else if (typ.value == "Masový speciál") { document.forms["pizzaFormular"].druh.value = "maso"; } else if (typ.value == "Hawaii") { document.forms["pizzaFormular"].druh.value = "sunkaAnanas"; } } <body><form id="pizzaFormular" action="#" onsubmit="return false;"><p> <input type="button" onclick="nastav(zelenSpecial)" name="zelenSpecial" value="Zeleninový speciál"/><input type="button" onclick="nastav(masoSpecial)" name="masoSpecial" value="Masový speciál" /><input type="button" onclick="nastav(hawaii)" name="hawaii" value="Hawaii" /> </p><p>Druh pizzy: <select name="druh"><option value="syr" selected="selected">Sýrová</option><option value="zelenina">Zeleninová</option><option value="maso">S masem</option><option value="sunkaAnanas">Se šunkou a ananasem</option></select></p></form></body>
  17. Matej

    ID/Name

    Hello there , i'd like to ask a question. When there is <input type="text" Id="GG" name="topic" value ="hi"> it is the same when i write var x=document.getElementById("GG"); x.value and topic.value ? Thanks for answers
  18. Well my code would work too , or wouldnt it?(cant test it atm)
  19. well yea it should be like <a id="lol"><img src="davej.jpg" name="slide"></a>var i = 0; var path = new Array(); path[0] = "pic1.jpg" ; path[1] = "pic2.jpg"; path[2] = "pic3.jpg" ; var change=new Array();change[0]="www.just.com";change[1]="www.some.com";change[2]="www.guy.com";function swapImage() { document.slide.src = path[i]; var m=document.getElementById("lol");m.setAttribute("href","change[i]");if(i < path.length - 1&& i<change.length-1){ i++;} else {i = 0;} setTimeout("swapImage()",3000); } window.onload=swapImage; or?
  20. <img src="devej.jpg" name="slide"> its like like if i set Id and than get it with var x. it would be x.src
  21. Thanks for answer/advice/information
  22. like this? var i = 0; var path = new Array(); path[0] = "pic1.jpg" ; path[1] = "pic2.jpg"; path[2] = "pic3.jpg" ; var change=new Array();change[0]="www.just.com";change[1]="www.some.com";change[2]="www.guy.com";function swapImage() { document.slide.src = path[i]; document.slide.href=change[i];if(i < path.length - 1&& i<change.length-1){ i++;} else {i = 0;} setTimeout("swapImage()",3000); } window.onload=swapImage;
  23. Wouldnt it set one href for all pictures? I'd like to set different href for all pictures
  24. Hello ,i have slide show : var i = 0; var path = new Array(); path[0] = "pic1.jpg" ; path[1] = "pic2.jpg"; path[2] = "pic3.jpg" ; function swapImage() { document.slide.src = path[i]; if(i < path.length - 1){ i++;} else {i = 0;} setTimeout("swapImage()",3000); } window.onload=swapImage; how do i set href for each pic?Thanks for answers
×
×
  • Create New...