Jump to content

Matej

Members
  • Posts

    185
  • Joined

  • Last visited

Everything posted by Matej

  1. Thank you . Yea sorry , im not good at naming thins or subject :/ anyway , i tried to add a child div to one of them here http://jsfiddle.net/hc4erouc/3/ but whenever i set both this.element.style.width=parseInt(this.element.parentNode.style.width/2)+"px"this.element.style.height=parseInt(this.element.parentNode.style.height/2)+"px" it aint working , but when i add just this this.element.style.width=parseInt(this.element.parentNode.style.width/2)+"px" // this works strange , it add width of element but instead of 50% of parent's width it adds 100% of parent's widththis.element.style.height=20+"px"
  2. hello , i have script http://jsfiddle.net/hc4erouc/2/ why does prototype function does not work and breaks the loop?
  3. Matej

    json question

    thanks for answers x[date][attribute] does not work but i made it like this var datum = new Date();var mesiac = datum.getMonth();var den = datum.getDay() - 2;var zisti=x[mesiac];document.getElementById("lol").innerHTML="Today is " +zisti[den]+"'s"+" namesday";
  4. Matej

    json question

    Hello, is there any way to invoke json attribute like array or with variable? For example: var x = [ {1:"matej"}, {1:"adam"}, {1:"clyde"}, {1:"jozko"}, {1:"matej"}, {1:"jude"}, {1:"john"}, {1:"marek"}, {1:"juraj"}, {1:"alex",2:"alojz",3:"idiot",4:"RESULT"}, {1:"matej"}, {1:"andrek"}, {1:"matej"}, {1:"brano"} ];var date=new Date().getMonth(); // 10var attribute=new Date()-getDay()-2; //4alert(x[date].attribute); // basicly i want it to alert "RESULT" , but this isnt working , i want to invoke lile this bcs i want it to change automaticly every day I hope i made this clear , this is basicly something like on school sites which writes who has birthday every day. Thanks for answers
  5. thanks for answers , but when var x gets destroyed after b ends how come alert does not get destroyed?
  6. Hello , i have a questions if i got it right , if i use call or apply , the function or object which is this code executed in with inherit specific properties , for example function a(args){ b.apply(this,arguments); // here we said , that function a should inherit stuffs from function B , it does inherit alert("lol") , but why doesnt it inherit x also? alert(x);} function b(){ alert("lol");var x=9;} a(); [/code] and second questionargument passing can be done by value or refference , value is usually primitive varriable like string or numberand refference is usually object. If i set [code]var g=9function call(x){x+=9;}call(g)[/code] var g inside function equals 18 , but globaly variable g still equals 9 , so why when i set var person=new Object;function call(x){x.name="david"}call(person) here if i call person.name outside of the function it equals "david" bcs i created copy of "person" and both of them reffer to one object in header; so why when i do this http://jsfiddle.net/nj5a84hm/ person.name="lol" and not "kek"? object should be passed by refference. (if objects are passed by value , person.name should be undeffined) Could someone explain it to me? thanks for answers
  7. ah you edited your post , so basicly this is string var text = '{"employees":[' +'{"firstName":"John","lastName":"Doe" },' +'{"firstName":"Anna","lastName":"Smith" },' +'{"firstName":"Peter","lastName":"Jones" }]}'; and mine was basicly JSON object right
  8. Hi , im getting into json and i came to problem var x={"menu": { "id": "file", "value": "File", "popup": { "menuitem": [ {"value": "New", "onclick": "CreateNewDoc()"}, {"value": "Open", "onclick": "OpenDoc()"}, {"value": "Close", "onclick": "CloseDoc()"} ] }}} this is some random json i found on their site , but here comes my question: i tried to get value of "id" var getit=JSON.parse(x);document.getElementById("one"),innerHTML=getit.menu.id but it aint workin , any help please?
  9. Thank you very much , but why is there difference between offsetTop/left and y.style.marginLeft/y,style.left , i mean , why it works second time with offsetTop/left and not with style?
  10. Well if first time i tell it , to use ahoj onmousemove , and second time just invoking ahoj with click (if i got it right) , why is chaning of innerHTML working like it should but div aint movin?
  11. oh:) , thanks for fast answers , but why did it work with "ahoj" and not with "ahoj()"? // http://jsfiddle.net/3kksmag5/4/ why does it works only first time? i mean , when "mouseup" and try to drag it again , it doesnt work
  12. i just came back to this , even tho i move mouse , its still the same http://jsfiddle.net/3kksmag5/1/
  13. Matej

    Collapse menu

    Hi there , i have this collapse menu http://codepen.io/anon/pen/kICuq , but i cant figure out ,how can i do that when i click on "menu" , second time ,the black div dissapear(the black div under the specific menu ofc)?
  14. Hello , i have this script http://jsfiddle.net/zKvVj/4/ but the second loop ain't working the error says Cannot read property 'children' of undefined can someone please help ? :)Thanks for answers // yes i know that script is wrong - will not work but im wondering why does that loop not work
  15. Matej

    Position

    Thanks for answers , Yes i could move the last div with javascript but if i did that , the other content would not move automaticly so I dont want to move it with javascript , bcs i would like to use this method for menu on website , so whenever i click on button , the "menu" appears from top so the content of the site moves down so the menu have space and doesnt cover anything. So is there any method how to do it? did i set wrong position on something or?:)Thanks for answers
  16. Matej

    Position

    Hi , i have this thing here http://jsfiddle.net/c0g770et/2/ but whenever i click on button , the green div stays on the same place , i want it to make space for the hidden divs , can anyone help me please?
  17. Thanks , tried that example but it didnt work :/ (even used it whit given HTML code in that example Uncaught TypeError: Failed to execute 'scroll' on 'Window': 2 arguments required, but only 1 present. (index):54onmousedown (index):54 is the error - first time i have seen something like that , even tho there should be only 1 argument... :/
  18. Thanks for answers , niche : thats paralax :/ and Hadien - i cant find that post :/
  19. thats jquery / css :/
  20. Hello , do you know any smooth scrolling tutorials in PURE javascript (no Jquery?)? I've been searching for a while now and so far i have found only tutorials with Jquery :/ , thanks for answers
  21. Matej

    multiple key

    Hi , is is possible to have more than one keyframe rule attached to one element? for example : http://jsfiddle.net/ft15mubo/ how can i set another keyframe for #lol ? Thanks for answers
  22. Matej

    input type range

    Hello , is there any way to style input[type=range]? by that i mean customize the thing you are moving with and the "line" Thanks for answers
  23. Matej

    dispatchEvent

    ah , so basicly i DIDNT create that simulated event , i had to create it first var event = document.createEvent("Mouseevents"); event.initEvent("click",true,true); or var event = new MouseEvent('click', {'view': window,'bubbles': true,'cancelable': true}) Which one is better? or it just depends on me
  24. Matej

    dispatchEvent

    THanks for answer so basicly it simulates the event? so why this thing does not work ? http://jsfiddle.net/19cbevvn/
  25. Matej

    dispatchEvent

    Hi , would anyone be so kind and explained the dispatchEvent() to me? i've been looking after it but i did not understand it from mozilla , IE developers and so on Thanks for asnwers
×
×
  • Create New...