Jump to content

Ingolme

Moderator
  • Posts

    14,901
  • Joined

  • Last visited

  • Days Won

    177

Everything posted by Ingolme

  1. Every time you write if (slide = 1){ You're making slide be 1 The = operator is for assignment, not comparison.
  2. URL rewriting is still available in Apache and IIS. You could rewrite URLs so that all paths that don't lead to existing files have ".html" appended to them.
  3. There isn't an attribute equivalent to that CSS rule. You can use the style attribute to have CSS code right in the element but I would recommend against it. The only reason you would not use CSS is if you were writing HTML code for an e-mail.
  4. They're just letters. There's nothing about them.
  5. You can use the same RewriteRule directive you're currently using, but by preceding it with those RewriteCond directives you'll make sure it doesn't apply the rule to URLs that point directly at existing files or folders on the site.
  6. In your htaccess file, always make sure the URL is not of an existing file or directory. You would add RewriteCond statements before your RewriteRule statement. RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d
  7. What language are you using to pull data out of the XML file?
  8. These errors are obvious if you would look at the code coloring.
  9. Using Date is more accurate, since incrementing time by a fixed number relies on the time interval always being the same (which it is not, it varies by a few milliseconds) To be even more precise you could research requestAnimationFrame(). It offers timestamps with microsecond precision and is also more efficient, since it lets the browser decide when is the best moment to run the function.
  10. I would recommend not bothering with degrees, really, radians are much easier to manage once you understand them Calling a function to convert radians on every frame is a waste of processing, do calculations before you begin the animation loop. Once again, you're mixing the mathematical + with the concatenation +: A * Math.sin( Math.radians( av ) * t ) + k + "px"; Either use parentheses to resolve ambiguities or split it into two lines of code. Here's how I would do it: // Just for making measurements easier var CIRCLES = 2 * Math.PI; // Parameters var A = 100; // Amplitude var v = 0.5 * CIRCLES; // Half a circle per second var start = (new Date()).getTime(); var k = 100; // Offset function animation() { var t = ((new Date()).getTime() - start) / 1000; var posY = A * Math.sin(v*t) + k; element.style.top = posY + "px"; } setInterval(animation, 50);
  11. You could substitute these three lines: document.getElementById("FarmOneButton").style.display = "none"; document.getElementById("FarmOneCost").style.display = "none"; document.getElementById("FarmOneInfo").style.display = "none"; For this: document.getElementById("FarmOneButton").parentNode.style.display = "none";
  12. There isn't much context to go by here. There's an HTML DOM tutorial here and an XML DOM tutorial here. If there's any particular thing you don't understand you can ask about it here.
  13. I'm not fully sure of your requirements. Seeing some code might help. When the button disappears, does the text under the button disappear as well?
  14. You have a variable "start" that is not being created or modified anywhere. The equation is: A*sin(ωt) + k A: Amplitude, in pixels ω: Angular velocity, or "what angle is covered in one second?" in radians. PI would be half a circle, 2 * PI would be a full circle. t: Time, in seconds k: Offset the center of the sine wave vertically, in pixels On every frame you need to update t, which Javascript provides in milliseconds using the date object, so you'll need to divide by 1000. When the program begins, store the current timestamp in a variable, each time the function is called get a new timestamp and subtract the first one from it. var start = (new Date()).getTime(); function sine() { ... var t = (new Date()).getTime() - start; t = t / 1000; ... } Another problem you might face is the ambiguity of the + operator. You should separate mathematical operations from string operations. Do the math first, store it in a variable, then work with the string on another line. var position = [equation here]; banner.style.top = position + 'px';
  15. If you put the margin on the button itself instead of wrapping it in a div then the margin will disappear when the button does. Are the div tags really necessary?
  16. Have you checked that your browser isn't zoomed in? In Firefox you can press Control+0 to reset the browser size. I'm not sure what cloud9 is, but you should test your pages in real browsers, since other environments may not be rendering things correctly.
  17. You should show us the PHP code for TwitterOAuth.php or if it's an API, then show the code that uses that API.
  18. The PHP is not executing because the file has a ".html" extension. Give the file a ".php" extension.
  19. Your HTML is wrong. Here's your code: <link rel="stylesheet" media="screen" and "(max-width: 480px)" href="480.css" /> <link rel="stylesheet" media="screen" and "(min-width: 1024px)" href="1024.css" /> Here's what it should be: <link rel="stylesheet" media="screen and (max-width: 480px)" href="480.css" /> <link rel="stylesheet" media="screen and (min-width: 1024px)" href="1024.css" /> I would recommend having your media queries in the main stylesheet using the @media rule so that the browser has to download fewer files.
  20. You need to create a page called "home.html" and put it in the same directory as the current page.
  21. You probably would do better with x = document.getElementsByTagName("a") instead of document.anchors.
  22. The code should be like this: var x = document.anchors ; for ( var i = 0 ; i < 5 ; i++) { console.log(x[i]); } Please look carefully at the differences between this and your original code.
  23. That is correct. The variable x contains the parent of node b, so you can call removeChild() on it to remove b from the document.
  24. There's a closing quote missing on this line: print "\t\tfont-size: " . htmlentites($_COOKIES['font_size']) . "; \n You can tell because all the following lines are colored green by the syntax highlighter. You just need to look at the code more carefully.
  25. The node you found is not a child node of the body's parent.
×
×
  • Create New...