Jump to content

Ingolme

Moderator
  • Posts

    14,901
  • Joined

  • Last visited

  • Days Won

    177

Everything posted by Ingolme

  1. Variables declared inside a function are only available inside that function. If you try to call addPerson outside the function it won't exist.
  2. The error message is saying that cowpies is not an image element. You can only draw image elements onto the canvas. When you called cowpies.push(new Cowpie); you added something that was not an image to the array, which caused this error.
  3. I would first need to fully understand the requirements before providing a solution.
  4. Shared hosting accounts can use certificates, it's just that people don't bother to buy them. Certificates go by domain name, not by server.
  5. This file works just fine in Firefox so we can't really know what the issue was. I'm quite sure it was just a missing </textarea> tag.
  6. If that was the case we would probably have seen a closing </ textarea> inside the text area field.
  7. I think the forum's syntax highlighting makes it obvious.
  8. Most likely you tried to close the textarea tag with /> rather than </textarea>. Since <textarea> is not an empty tag it would not be considered closed by the browser.
  9. I would look for a Facebook API. But I cannot tell if Facebook allows you to write posts using an API.
  10. You could attach the HTML file on a post in this forum. That should be good enough for testing. Make sure that you were able to reproduce this error in the file before uploading it.
  11. this most likely refers to greeting3. If it was referring to the parent object it would be [object Person]
  12. The code you posted here looks fine, is it possible for you to put an example online so we can see what the browser is doing?
  13. 1. Setting background-size to cover http://www.w3schools.com/cssref/css3_pr_background-size.asp 2. Elements extend to the full width of their container by default. If you have an element with a blue background, there will be a blue bar all across the screen unless it's contained by another element that has a smaller width. Media queries can be used to arrange the buttons. For more details see the CSS responsive tutorial: http://www.w3schools.com/css/css_rwd_intro.asp 3. Photoshop can be used to draw mock-ups, but don't use it to generate HTML files. Just look at the design created in photoshop and write CSS that makes the page look like that. 4. I design in photoshop first, but sometimes just pencil and paper with some notes about color works OK. 5. I would not restrict myself to one style. The style of your page should reflect the theme of the page. If you're making a page about a cartoon the metro style is going to be really bland. 6. My preference is to use fonts for the icons on the page. 7. Showing and hiding elements is done with Javascript. I would recommend reading the Javascript tutorial. 8. There are hundreds of little details you need to know to make websites optimally, but these are gained with research and experience. I cannot give any real tips here in a single forum post, try reading blog articles from experienced web developers.
  14. The issue is that your image path is relative to the current directory, which is the last slash of the URL. You can solve that by always having the image relative to the site root, which is represented with a leading slash: /images/logo_e.png
  15. There are at least two issues. 1. cowpie is not a property of an HTML element: cowpies[i].cowpie.idActive If the element has a property "idActive" you would access it like this cowpies[i].idActive 2. pop() is a method of cowpies, not of cowpies. And the variable cowpie is undefined: cowpies[i].pop(cowpie) pop() always removes the last element of an array and it does not take any parameters. You probably want to use the splice() method instead.
  16. It seems you have an unclosed parenthesis on this line: var Cowpie = (function () { It would be helpful if you told us what line of code the browser indicated the error was on. Another issue is on these lines: this.x = thrower.x; this.y = thrower.y; thrower has not been declared yet. In the specific block of code you pointed out, self is not accessible. You can use this and it will work there because the method belongs to the prototype.
  17. I don't understand the logic of that code. You're counting the amount of searchPageSections elements, but then modifying that number of tooltip elements. Have you checked the javascript console for errors? It would be more efficient to store the result of querySelectorAll() in a variable before using it.
  18. In your first code block it doesn't look like sections exists anywhere.
  19. Making it global has the problem that if you create more than one instance of the object "self" only refers to the last instance created. Just try creating two people and you'll see the problem. Why is it necessary to have greeting 3 outside of the constructor?
  20. That's what SSL was invented for. They're not plain text when transmitted over HTTPS.
  21. this most likely refers to greeting2/greeting3 rather than Person. You should have a reference to the object itself like this: function Person( firstname, age, place ) { var self = this; self.firstname = firstname; self.age = age; self.greeting = { Hello: function(){ console.log( "Hello " + firstname ); }, YouAre: function(){ console.log( "You are " + age + " years old"); } } self.greeting2 = { Hello: function(){ console.log( "Hello " + self.firstname ); }, YouAre: function(){ console.log( "You are " + self.age ); } } } For greeting3, if you want access to the self variable it will need to be declared inside the Person function.
  22. Ingolme

    CSS and risks

    I think there was once a vulnerability where the browser would execute Javascript in the background image url, but that was years ago and most likely it's been patched up. As far as I know there is no security vulnerability in CSS. If you include user content inside a style tag be sure that you don't allow them to write HTML because they could close the style tag and open a script tag. Always escape < and > with < and > when displaying user generated content on the page.
  23. I'm just saying you don't need some odd polyfill to make a cross-browser solution. getAttribute() works 100% which negates the need for jQuery, which seems to be the point you were trying to make. jQuery is not any easier than vanilla JS for this particular solution.
  24. getAttribute works on all browsers. So there's no cross-browser compaibility problem.
  25. I stick with getAttribute() for data attributes because I don't actually see an advantage to the more modern version. It's just what you'd call "syntactical sugar".
×
×
  • Create New...