Jump to content

Ingolme

Moderator
  • Posts

    14,901
  • Joined

  • Last visited

  • Days Won

    177

Everything posted by Ingolme

  1. HEre's a link to the tutorial: https://web.archive.org/web/20100304150857/http://www.w3schools.com/flash/default.asp I never found anything useful in it. I'm a volunteer moderator, yes, but I know that W3Schools never had much useful information about Flash.
  2. The flash tutorials never had much in them to begin with, they were bad. It's best to find another website for Flash tutorials.
  3. Probably plain Javascript. Animation can be done without jQuery, jQuery just makes it easier.
  4. I'm not sure what your thread is about. HTML 5 was designed to perform a lot of functions that have been a necessity on the internet but could only be done with plug-ins. Flash is, slowly, being dephased in favor of HTML 5. Flash is useful for other purposes, but for web applications HTML 5 is the best tool.
  5. You have a misunderstanding of the return statement. Once return is called, the function stops running. Anything after return is like it doesn't exist. function a() { return 1; console.log(5); // This line never gets executed because return leaves the function}
  6. Ingolme

    !operand

    The ! operator returns a boolean value that can be true or false. !false is true, !true is false. If the data type is not boolean it will be cast to boolean. All numbers are considered true except zero. All strings are true except an empty string. If timer_is_on is 0, then !timer_is_on is true, if timer_is_on is any number other than 0 then !timer_is_on is false.
  7. A string delimited by single-quotes won't parse the variables within it. You can read about strings and variables here: http://es1.php.net/manual/en/language.types.string.php
  8. A session variable is the same as any other variable. What does echo.php currently have?
  9. Set line-height to 19px as well and it should look fine.
  10. I would recommend storing the values in a session: session_start();$_SESSION['array'] = array( $index_id, $weekly_gen_news, $what_is_env, $things_in_env, $need_to_clean, $how_does_env, $african_env, $env_culture, $env_and_event, $cnn_env, $weekly_gen_news);session_write_close();header('Location: echo.php'); Read about sessions here: http://www.w3schools.com/php/php_sessions.asp
  11. Do the <html> or <body> elements have event listeners or tabindex attributes?
  12. Ingolme

    Help!

    It seems you copied the line numbers from the code box. Remove those, that's not my code's problem.
  13. Ingolme

    Help!

    The second block wasn't code. It's an explanation. I used the codeblock because I needed indentation to make it more readable.
  14. Ingolme

    Help!

    The result is adding an extra 1 to it because I didn't think out the function well. Explaining why might be a bit complicated unless you understand the function. The key to the recursion is this line: return levels + sum(levels - 1); sum() is the function that is currently being executed. First, I'll fix the function to remove the error I had: function sum(levels) { if(levels <= 1) { return levels; } else { return levels + sum(levels - 1); }}console.log( sum(4) ); Now I'll do what's called a "trace". That means I pretend I'm the computer and I follow the instructions # 8. Call sum() and pass 4 to it# # Inside sum() [level 1]# 1. levels is 4# 2. Is levels less than or equal to 1? It isn't, so go to line 5.# 5. We need to call sum() again, but give it (levels - 1), which is (4 - 1 = 3)# Store the current value of levels in the stack: stack is [4]# # Inside sum() [level 2]# 1. levels is 3# 2. Is levels less than or equal to 1? It isn't, so go to line 5.# 5. We need to call sum() again, but give it (levels - 1), which is (3 - 1 = 2)# Store the current value of levels in the stack: stack is [4, 3]# # Inside sum() [level 3]# 1. levels is 2# 2. Is levels less than or equal to 1? It isn't, so go to line 5.# 5. We need to call sum() again, but give it (levels - 1), which is (2 - 1 = 1)# Store the current value of levels in the stack: stack is [4, 3, 2]# # Inside sum() [level 4]# 1. levels is 1# 2. Is levels less than or equal to 1? Yes, it's 1, so go to line 3.# 3. Return levels, which is 1# # Inside sum() [level 3]# 5. We have the value of sum()[level 4], it's 1, so add that to levels,# which is the last element in stack [4, 3, *2*], levels = 2.# Return (levels + 1) = (2 + 1) which is 3,# then remove the element from the stack: stack = [4, 3]# # Inside sum() [level 2]# 5. We have the value of sum()[level 3], it's 3, so add that to levels,# which is the last element in stack [4, *3*], levels = 3.# Return (levels + 3) = (3 + 3) which is 6,# then remove the element from the stack: stack = [4]# # Inside sum() [level 1]# 5. We have the value of sum()[level 2], it's 6, so add that to levels,# which is the last element in stack [4], levels = 4.# Return (levels + 6) = (4 + 6) which is 10,# then remove the element from the stack: stack is empty## 8. Print out the return value of sum(4): 10
  15. Ingolme

    Help!

    Oh, my mistake. Every recursive function needs to have a condition that ends the recursion, which I forgot to add. function sum(levels) { if(levels == 1) { return levels + 1; } else { return levels + sum(levels - 1); }} To understand recursion you need to try to read the code and write what it's doing on paper to see what's happening. Each time that the function is called, you need to remember that it was so that you can go back to it. The place where this remembering occurs in the computer is called the stack memory.
  16. An element is being focused. Does the <div> have an event handler attached to it?
  17. It looks like $_SESSION['error'] is not an array. See what value it has: var_dump($_SESSION['error']);
  18. It looks like you have an element that can be focused wrapped around your page. Check for unclosed <a> elements or something like that.
  19. Ingolme

    Help!

    Recursive means a function that calls itself. This function sums all the numbers from 1 to the number you give it: function sum(levels) { return levels + sum(levels - 1);}console.log( sum(5) ); // Shows 15 which is 1 + 2 + 3 + 4 + 5
  20. Their solution is a decent one. Floating point operations can often give you results like 0.40000000000001 or 0.99999999999998 for apparently no reason. By multiplying and dividing you can avoid that problem. console.log(0.1 + 0.2); // Shows 0.30000000000000004console.log( (0.1 * 10 + 0.2 * 10) / 10 ); // Shows 0.3
  21. The educational approach needs to be more simplistic. You're working with a Javascript console? You can use console.log() to print answers which simplifies the understanding process. It's clear why W3Schools examples use document.write(), trying to use DOM manipulation while teaching Javascript is likely to confuse the user. Indenting the code helps understand things. Every opening curly brace "{" has a matching closing curly brace "}" in the code. All the content between the braces is called a "block" of code. Most control structures can use curly braces and some of them require them. The return statement of a function gives data back to the piece of code that called it, like in the following example: function five() { return 5;}console.log( five() ); // Displays "5" in the javascript console When a function is called, it may sometimes have arguments, as in the following example: function add(a, { return (a + ;}console.log( add(2, 3) ); // Displays "5" in the Javascript console because 2 + 3 is 5 The for() loop is explained in the W3Schools tutorial. The *=, +=, ++ and other operators are in the operators section of the tutorial. Knowing how the for loop works, the following code should be simple to understand: function power(base, exponent) { var result = 1; for(var count = 0; count < exponent; count++) { result *= base; } // This curly brace closes the for() loop return result;} // This curly brace closes the function() definition
  22. Put it in a box with size restrictions. I'm not sure if this is really a PHP question. <div style="width: 600px; height: 600px; overflow:auto;"> <?php echo contents; ?></div> If this content has a full HTML document, put it in an <iframe> <iframe src="file.php" width="600" height="600"></iframe>
  23. Most likely something like this: SELECT getID('username') FROM users I'm not entirely sure if the FROM clause is required but you might be able to remove it.
  24. That's not exactly how crypt() works. The crypt function uses a salt. To compare a password with another one they have to be encrypted with the same salt. you can read about crypt() in the PHP manual.
×
×
  • Create New...