Jump to content

Matej

Members
  • Posts

    185
  • Joined

  • Last visited

Posts posted by Matej

  1. and it starts again, in both outcomes the settimout will still be called to run swapImage().

    setInterval in this will be called on every loop, and every call will add another setinterval

    basicly whenever i invoke function with setTimeout within that function that i want to invoke , the setTimeOut works as setTimeout+setInterval ?

  2. well , think i still dont get why it is invoking itself in intervals (setInterval is NOT there and setTimeout is just delaying invoke of function) i would understand it , if there was setInterval... but setTimeout which just delay invoke of the function..

  3. yo, this code

    var i = 0;function swapImage() { var kk=document.getElementById("branka");kk.src=path[i];var mm=document.getElementById("vole");mm.setAttribute("href",change[i]); if(i < path.length - 1&& i<change.length-1){ i++;} else {i = 0;} setTimeout("swapImage()",3000); } window.onload=swapImage;

    is used for bad looking slide-show , but my question is , why is this function executed every 3s? it should be executed once

    (it check if i<array.length and if its true i goes up(i++))no? there isnt setInterval , so why is this function executed every 3s? there is only delay wth seTimeout , thanks for answer

  4. Hi , im trying to understand ajax , here is my script

    <!DOCTYPE html><html><head><script>function loadXMLDoc(){var xmlhttp;if (window.XMLHttpRequest)  {  xmlhttp=new XMLHttpRequest();  }else  {  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");  }xmlhttp.onreadystatechange=function()  {  if (xmlhttp.readyState==4 && xmlhttp.status==200)    {    document.getElementById("myDiv").innerHTML=xmlhttp.responseText;    }  }xmlhttp.open("get","texttest.txt",true);xmlhttp.send();}</script></head><body> <div id="myDiv"><h2>Let AJAX change this text</h2></div><button type="button" onclick="loadXMLDoc()">Change Content</button> </body></html> 

    the texttest.txt contains just

    <p>hello world</p>

    but it isnt working , it writes Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'file

     

    can anyone help me please? :)

  5. Hi i have script

    <p id="lol" onmouseover="zmena()" onmouseout="sopka()">ahoj</p>
    var x=document.getElementById("lol");var start;var zacni=0;function zmena(){if(x.innerHTML=="ahoj"){x.innerHTML="cau"}else if(x.innerHTML=="cau"){x.innerHTML="hi"}else if(x.innerHTML=="hi"){x.innerHTML="ahoj"} zacni=1;} function sopka(){x.innerHTML="ahoj";zacni=0} function timing(){if(zacni){start=setInterval(function(){zacni()},1000);}else{clearInterval(start);}} window.onload=timing;

    I wanna start again chaning of changing innerHTML on mouseover , but it doesnt work can someone help?

  6. thanks , so basicly it does not change anything till i "invoke it" or set the value of it to something , also where can i found the documentation about stuffs like this? like what returns value etc.

  7. thanks , is there any difference between

     

    function(e){alert(e.target);}

    and

     

    function(){alert(event.target);}

    there is written the second case in documentation , but it does not work , but the first does.

  8. Hello gentlemen.

     

    Im trying to understand addEventListener and i came to this script

     

    <p id="lol" > hello world </p>

     

    var g=document.getElementById("lol");g.addEventListener("click",myfunction(){alert(event.target);},false); 

     

    but it does not work , i tried it with "true"(altought im not quite suire if i understand when to use false /true).

  9. Hello gentlemen

    <table id="outside">    <tr><td id="t1">one</td></tr>    <tr><td id="t2">two</td></tr></table>
    var t2 = document.getElementById("t2");alert(t2.firstChild.nodeValue)

    Why does this alert "two" (value of t2) while t2 does not have childrens?

     

    but when i use

    var t2 = document.getElementById("outside");alert(t2.firstChild.nodeValue)

    it does not alert anything

    Also can someone explain to me when do i use "true" and when do i use "false" in element.addEventListener()?

     

     

    Thanks for answering and have a nice day

  10. Thanks , i made it working with this

     

    var video = document.querySelector("#videoElement");navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia || navigator.oGetUserMedia;if (navigator.getUserMedia) {navigator.getUserMedia({video: true}, handleVideo, videoError);}function handleVideo(stream) {video.src = window.URL.createObjectURL(stream);}function videoError(e) {// do something}

     

    i put it in function and made it onclick event , but i was wondering , how could i make that function stop?

  11. Hello gentlemen

     

     

    i'd like to "connect" webcam and my website with webcam(something like chatroullete but instead , you will see your own image from webcam , you and only you") but i have no idea how to do it .

     

    Would you be so kind and give me some hint or idea how to do it?

     

    Thanks , and have a nice day.

×
×
  • Create New...