Jump to content

Ingolme

Moderator
  • Posts

    14,901
  • Joined

  • Last visited

  • Days Won

    177

Everything posted by Ingolme

  1. Ingolme

    HSL to RGB

    I'd search on Google if I had the time. It is probably not that complicated and is likely documented somewhere, possibly even on Wikipedia.
  2. Ingolme

    AJAX

    You have to add an onreadystatechange event listener. Check the AJAX examples in the tutorials. That is the event which fires once the server has given a response.
  3. The cookies for a page are stored as a query string in which special characters are encoded, decodeURIComponent is correct.
  4. The menus work fine in Internet Explorer 11, however, the site and the code look like they came straight from the 90s. Fixing invalid HTML may help solve some issues: https://validator.w3.org/nu/?doc=https%3A%2F%2Fwww.barmirrors.com%2F1american_beer_page_1.htm
  5. It's probably missing. For complete documentation, I'd suggest the Mozilla Developer Network. They have one of the most comprehensive Javascript, CSS and HTML references on the internet. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty
  6. There is a "REPORT ERROR" button at the bottom of the page which you can use to tell the W3Schools staff that a page has a mistake.
  7. It looks like a case of collapsing margins. The quick solution is to set "overflow: hidden" on the content container. The better solution is to give the container a ::before pseudo-element with "display: table".
  8. Ingolme

    syntax error

    You did not select CustomerID from table A, so you cannot access it. Perhaps you actually want to select N1.
  9. That's because you're always within the scope of the window. Anything that belongs to the window can be accessed without typing window unless a local variable or function of the same name exists.
  10. The canvas behaves like an image, so you have to set the text-align of its parent, which is the body in your case. body { text-align: center; } The <script> tag is irrelevant, if I were you I would put it at the bottom of the page outside of all of the rest of the elements.
  11. Here it is: document.body.appendChild( renderer.domElement ); This line of code puts the canvas as a direct child of the body. Just append it to a different element if you want it somewhere else.
  12. The Javascript generates a <canvas> element. The best thing to do is to give the canvas a negative Z-index and use absolute positioning to stretch it to the full size of its container. I'm not exactly sure how much the THREE.js framework will get in your way, though. It might be trying to resize the canvas on its own.
  13. When Javascript runs, it only has access to the part of the page that has been loaded. Content below it does not exist yet. You can either move your code to the bottom of the body or have a window DOMContentLoaded event to run the code after the page has finished loading.
  14. Is your code running inside a frame on another website?
  15. I don't see any practical reason to search for all keys at every level inside an object. If they don't build such a feature into the language it's probably to discourage people from doing it.
  16. You can use a CSS pseudo-selector to put some fake content inside the output element to allow it to keep its height. output::before { content: "."; display: inline-block; width: 0; overflow: hidden; }
  17. A recursive function is the easiest way to do it, but it's possible to replace any recursive function with an iterative process and stack memory, though I would advise against it since it's messy.
  18. One way to do it is to check for the :focus pseudo-selector on the button: https://www.w3schools.com/code/tryit.asp?filename=G28YN9O8VU3C It has its drawbacks, but I'd need to know what your expectations are. With Javascript the menu could behave however you like, with CSS there are limitations.
  19. Just echo the value there, but be sure to wrap it in Javascript quotes.
  20. Personally, I don't think the W3Schools staff should be encouraging the use of frameworks like React, they're bad for accessibility and SEO.
  21. I personally would avoid the first way just because it's using an onload HTML attribute. As far as choosing whether to create the canvas with Javascript or have it right in the HTML, it doesn't make a big difference. You might want to not have a canvas on the page when Javascript is disabled and show something else instead.
  22. The problem is the quote marks in size="2" which are ending your JSON string, you need to escape them with backslashes or replace them with single-quotes. Unrelated, the <font> tag is deprecated and should not be used.
  23. I don't know what the unsplash API is, but you should look for their documentation.
  24. There's a transition-delay property https://developer.mozilla.org/en-US/docs/Web/CSS/transition-delay
  25. If you want a solution without JS you can set the position to "sticky" instead of fixed. The only drawback is that the sidebar can't be the full height of the screen, but I think it still looks pretty good.
×
×
  • Create New...