Jump to content

Ingolme

Moderator
  • Posts

    14,901
  • Joined

  • Last visited

  • Days Won

    177

Everything posted by Ingolme

  1. That's the wrong way to use a <p> tag. The difference between <p> and <div> is that <p> is meant to contain paragraphs of text and <div> can contain anything. Whoever is using the <p> tag there probably wanted the default styling from it. You can apply margins to the <div> element for that.
  2. There are certain data types called NodeList or HTMLCollection that the browser uses in the DOM, it can be accessed like if it was an array but it is an object. getElementsByTagName() and many other DOM methods also return a NodeList which behaves the same way. You can't create objects like that using Javascript, it is something the browser does internally. Technically, the [] notation is not official, the specification says to use the item() method instead: document.getElementsByTagName("a").item(0);
  3. Actually, you can create a function using the new operator, but it's inefficient because it has to evaluate a string as code. var a = new Function("return 5"); But functions are more than just object prototypes. They are different because they can be called. They have a particular behavior that makes the keyword "function" a necessary and unique part of Javascript. jQuery is just an object, so you don't need the new keyword to load it. A simplified version of jQuery could be something like this: /* This is jQuery */var $ = function(param) { // Return an element or list of elements given "param"}/********************//* Now in your code you don't need the "new" keyword */var element = $("#container");/********************/
  4. I'm trying to find out, but the specification does not seem to say anything about whether the target window or frame will be focused. If it says nothing, then you can't count on all the browsers behaving the same way. I think it's likely that the user can choose whether to focus new windows or not in the browser settings.
  5. As it stands right now, Javascript on the server-side would be be practically useless because of the costs of creating an interpretter or hosting that runs one. Just learn PHP, ASP or C++ if you want to program on the server side. I believe server-side programming would be too complicated for you at the moment, just continue learning client-side Javascript.
  6. IE has been supporting <embed> since version 6, at least, which would be around 2002. Interestingly, <embed> wasn't even a standard then but all browsers supported it. This is why it was added into the HTML 5 standard. The <embed> tag was made up by Netscape and simply caught on with all browsers. It's not valid HTML 4.01 to use the <embed> tag, so pages that were using it were wrong. The <object> tag was the standard way and it doesn't need an <embed> fallback, at least for Flash. Other plug-ins perhaps did, but not Flash. Plug-ins are being phased out now with HTML 5 being able to perform tasks that plug-ins used to do.
  7. Your <meta> tag isn't right, even for HTML 4.01. You're using "keywords" and "description" as attribute names rather than meta names. A meta name is within the name attribute. It needs to be like this: <meta name="keywords" content="key, word"> I don't have a lot of time these days so I can't go through your whole post at the moment.
  8. There's an explanation here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create It's not really relevant to what you're learning, though, so just pretend it doesn't exist.
  9. Replace all the height and background attributes with CSS. I'm not sure, without seeing your code, what the problem might be with the <meta> tags.
  10. There's no disadvantage to using the HTML 5 doctype, even old browsers interpret it as a standards compliant page. If you're planning to use HTML 5 elements, you then need to discover which browsers support them and in what ways you can make up for the browsers that don't. (For example, falling back to Flash in the case of <video> or <audio> elements. You already have shown interest in the <video> and <audio> elements, it would be incorrect to use them in an HTML 4.01 document. Other things such as <canvas> and new input types like color picker and date also require the HTML 5 doctype. I would recommend pushing forward as much as possible, browser vendors react more rapidly when there is a high demand for the new standard. HTML 5 isn't going to be "finished" for another eight years but it's called a "living standard" which means that as things get documented you already can start using them. W3C and WHATWG recommend not waiting.
  11. GIF images do that because they try to play as they are loading. If your internet isn't really fast they'll stop at a frame while the next one is getting loaded.
  12. Ingolme

    Style in comments

    It's a technique that's useless today. Back then in the late 90s when not all browsers had implemented the <style> tag, text between <style> tags would show up on the page in browsers that didn't support it. You'll see the same thing done with <script> tags on websites with developers who aren't sure why it was done and continue to do it because that's what they were taught. It takes decades for old irrelevant practises to die out.
  13. If things were so easy to learn online without classes and professors then universities and colleges would be out of business.
  14. Ingolme

    MOAR SVG!

    The SVG tutorial tells you pretty much all you need to know about SVG. Animation on the web is not done using SVG, it's done by changing the properties of different elements on the page.
  15. It's incorrect to not use a table for database information. Tables have a particular use.
  16. Are the error arguments standard? Under the W3C model event handlers should take just one parameter that holds data about the event. This possibly also applies to the error event.
  17. Forget WebGL, it's too complicated, it requires knowledge of other, more complicated programming languages. Just focus on learning Javascript.
  18. The problem is here: myfunction(){alert(event.target);} To declare an anonymous function you use the function keyword. Simply function(){alert(event.target);}
  19. The first case returns nothing, The second case returns an empty object.
  20. You may have misunderstood the definition.
  21. An element is a type of node. A node is a part of a data structure called a tree. Tags and everything between them are a text representation of an element.
  22. The problem is that you put the code at the top of the page, before any of the elements are loaded. You can either use .ready() event or put the script at the end of the </body> section,
  23. Onload waits for all the resources, including images and videos, before running a script. The async and defer attributes only wait for the HTML code to load before running.
  24. I'm going to need to see your own implementation of the code to determine why it's not working. Check your browser's javascript console to see what errors occur and on what line.
  25. It requires jQuery. To make jQuery work you need to include the jQuery library with a <script> tag. You can either do that or look for code that doesn't need jQuery, because I think including jQuery would be overkill for a tiny task like that.
×
×
  • Create New...