Jump to content

Matej

Members
  • Posts

    185
  • Joined

  • Last visited

Posts posted by Matej

  1. Hello , i have table editor here > http://jsfiddle.net/dw0pck23/ < but the last function does not work .

    First you chose which cell you want to remove and than you chose on what row.

    But function zmazbunku() does not work , it always writes Cannot read property '4' of undefined

    the "4" is basicly value of the first input-1

     

    Can someone help me with this?:) , thanks for answers at h

  2. Hello , i found drag and drop tutorial but i didnt get one thing

    here is the link - http://luke.breuer.com/tutorial/javascript-drag-and-drop-tutorial.aspx - (if you are too lazy to open it i can copy the code :D)

     

    So back to my question

    as first he defines

     var _startX = 0; 

    than in mousedown invoking function he redefine it like this

    _startX = e.clientX;
    so now starX does not equal 0 but location of mouse in X line

    and in mousemove invoking function he does this

    _dragElement.style.left = (_offsetX + e.clientX - _startX) + 'px';

    1)basicly _offsetX=event.target.style.left;

    2)e.clientX = position of mouse in X line

    3)_startX = is also position of mouse in Xline;

     

    so that means that 1)500+2)1000-3)1000 = 500 , so it shouldnt even move

     

    could someone please explain it? or if i got it wrong also explain it :D , thanks for answers

  3. Thanks :) it helped me althought i have another "problem" .

    Here http://jsfiddle.net/96eLrn6e/ it seems like the function is omitting the last number in the first input , for example

    if 1st input value = 2 , the 2nd input value should = 3 , but in this case it = NaN;

    but when 1st input value=22, the 2nd input value = 3 so basicly its like omitting the last number .

  4. Hi , i have input

     

     

    <input id="lol" type="text" name="form_number" size="20" onkeypress='return isNumberKey(event)'>

    and you can only write there numbers from numpad keyboard - i have it with this script

     

    function isNumberKey(evt) {    var charCode = (evt.which) ? evt.which : evt.keyCode;    if ((charCode < 58 && charCode > 47)) {        return true;    } else {        return false;    }}

     

    But what if i want it to do another function on kezdown/keypress? is it possible? for example another function , can i set keydown and at the same time keypress in the same input?

  5. also i would like to do the thing , that you can use "-" only twice in a row , but

     function ahoj(plot){if( x.value.lastIndexOf(plot)!=x.value.length-2){    x.value+=plot;}} 

    any hint? :)

  6.  

    var x=0;for(var i=0;i<10;i++){    if(i%5==0){continue}    x++;}alert(x)

     

    why does x=8 here? shouldnt be it 9? when i=5 the loop exits(omiting increment) and continues which means when i=5 x=5 also , so x should have end as 9.

  7. Hi , how can i do (or how its called) a window , which on load will ask me some question or tell me some message , and after aj close it or "accept" it , it will let me go to the site? without URL change.

  8. Thanks , but this function seems wierd to me

     

    function init() {var lasttime = null; //this variable is a static localfunction dtime(){var now = new Date().getTime();var delta;if (lasttime == null){ // this is true so delta will be 0 on the first invoke , delta = 0;}else{delta = now - lasttime;  //on the second and so on invokes this is true , but shouldnt this equals to 0 also? basicly now=new Date().getTime() and "lasttime"=now , so it should equals 0 shouldnt it?}lasttime = now;// update the static local vardocument.getElementById("out").innerHTML = delta + ' milliseconds';}document.getElementById('btn1').onclick = dtime;}//end of init window.addEventListener('load',init, false);
  9. Hi , what is(are) function enviroment and scope? This is the first time i hear something like that .

    Im asking because of this example http://jsfiddle.net/v7gjv/1/ and the text that explains why is there makeHelpCallback closure.

     

    "The reason for this is that the functions assigned to onfocus are closures; they consist of the function definition and the captured environment from the setupHelp function's scope. Three closures have been created, but each one shares the same single environment. By the time the onfocus callbacks are executed, the loop has run its course and the item variable (shared by all three closures) has been left pointing to the last entry in the helpText list."

     

    Thanks for answers

×
×
  • Create New...