Jump to content

etsted

Members
  • Posts

    274
  • Joined

  • Last visited

Posts posted by etsted

  1. in w3schools it says that i have to use POST when A cached file is not an option (update a file or database on the server). What does that mean?

  2. Why do you think that's the case? Where are you telling it to run the handler for btn2 when you click on btn1?

    because they have the same first parameter "click".

    thescientist, i have updated the script, so that btn2 has a referance

  3. what does it mean that i can back-reference the canvas element through the context object in this script?

     

    alert(ctx.canvas.id+" | "+ctx.canvas.width+" | "+ctx.canvas.height);

     

    in w3school they would only write "ctx.id".

  4. when i use the setTimeout function why do i have to use quotes around the first parameter when it is a function?

     

    <script> function renderTime() {var time = new Date();var h = time.getHours();var m = time.getMinutes();var s = time.getSeconds();var diem = "AM";

    if( h == 0){ h = 12;} else if(h > 12){ h = h - 12;diem = "PM";}

    if(h < 10){h = "0" + h;}

    if(m < 10){m = "0" + m;}

    if(s < 10){s = "0" + s;}

    var clock = document.getElementById("displayClock");clock.innerText = h + ":" + m + ":" + s + " " + diem;clock.innerText = h + ":" + m + ":" + s + " " + diem;setTimeout(renderTime(),1000); }renderTime();</script>

  5. This is my script:

     

    <!DOCTYPE html>
    <html>
    <head>
    <script type="text/javascript">
    function addEventHandling(){
    var btn1 = document.getElementById('btn1');
    btn1.addEventListener('click', function(){btnClick("eggs","beef")}, true);
    btn2.addEventListener('click', function(){btnClick("grid","hest")}, false);
    function btnClick(arg1,arg2){
    alert("This button click has "+arg1+" and "+arg2+" associated with it.");
    }
    }
    window.onload = addEventHandling;
    </script>
    </head>
    <body>
    <button id="btn1">I have food associated with me</button>
    <button id="btn2">I have food associated with me</button>
    </body>
    </html>
    and as i understod it, when i click on btn1, btn2 should trigger, but thats not the case. I have tried to use both false and true values as the third argument, but nothing special happens. They still run the same.
  6. $previous = '';

    $paginationCtrls .= '<a href=" ' . $_SERVER['PHP_SELF']. '?pn=$previous">Previous</a>';

    $paginationCtrls .= '<a href="$_SERVER['PHP_SELF']?pn=$previous">Previous</a>';

     

    only the second code Works, becuase i have used single quote concatination, why doesnt the third line work?

    php

    i am trying to understand this code, my question is. Where does the 1 sign at the front of the output come from?

    When u output this, there is a number 1 at the front

     

    $myArray = array(500.00, 300.00, 200.00); $result = 2; foreach ($myArray as $key => $value) { $result = $result + $value; } $output = number_format($result, 2, '.', ','); echo "<h2>$". $output. "</h2>";

     

    the result is:

    $1,000.00

    where does the 1 come from?

  7. i am trying to get the chat_box to be display right under message_box. But i wont go any further up.

     

    <style type="text/css"> #mainDiv{ width: 700px; margin-top: -150px; } #mainDiv > #message_box{ width: 500px; height: 400px; background-color: green; float: left; margin-top: 200px; } #mainDiv > #player_box{ width: 200px; height: 600px; float: left; background-color: red; margin-top: 200px; display: inline; } #mainDiv > #chat_box{ width: 300px; display: inline; float: left; margin-bottom: 150px; } </style></head><body><div id="mainDiv"> <div id="message_box"></div> <div id="player_box"></div> <div id="chat_box"> <form method="POST" action="index.php"> <textarea rows="5"></textarea> <input type="submit"/> </form> </div></div>

  8. i am trying a script that wont work when i use double quotes like this:

    setTimeout('resetScroller("+el+")',speed);

     

    but instead i have to use thi syntax:

    setTimeout('resetScroller(''+el+'')',speed);

     

    whats the diffrence? Because they wont give the same result.

  9. i got a little script i want to show:

     

    var scrollY = 0;
    var distance = 40;
    var speed = 24;
    function autoScrollTo(el) {
    var currentY = window.pageYOffset;
    var targetY = document.getElementById(el).offsetTop;
    var bodyHeight = document.body.offsetHeight;
    var yPos = currentY + window.innerHeight;
    var animator = setTimeout('autoScrollTo(''+el+'')',24);
    if(yPos > bodyHeight){
    clearTimeout(animator);
    } else {
    if(currentY < targetY-distance){
    scrollY = currentY+distance;
    window.scroll(0, scrollY);
    } else {
    clearTimeout(animator);
    }
    }
    }
    this is supposed to clear the "animator" if yPos is greater than bodyHeight, but woudnt yPos and bodyHeight have the same value?
    if not explain.
  10. there are many functions in js that uses the word offset, now i have search a little but i still dont understand it. What does offset mean?

    give me a nice and easy example.

  11. i am trying to use a .htaccess on my website, but it wont work.

    When i try to write in a fake url in the address bar i get the following error:

     

    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

     

    this is my .htaccess file:

     

    # 1 ---- Establish a custom 404 File not Found page ----ErrorDocument 404 /index.php# 2 ---- Prevent directory file listing in all of your folders ----IndexIgnore *

     

    this is the fake url i used when testing the .htaccess:

     

    http://localhost/root/fdsdf.php

     

    // all of my files are stored inside "root"

  12. how should the UNIQUE KEY syntax look?

     

    // is this right?

    UNIQUE KEY username (username, email)?

     

    // or this??

    because i think this is the right syntax, but i have seen some use the above. Why?

    UNIQUE KEY(username, email)??

     

    Is both legit?

×
×
  • Create New...