Jump to content

Ingolme

Moderator
  • Posts

    14,901
  • Joined

  • Last visited

  • Days Won

    177

Everything posted by Ingolme

  1. It should be safe to use the "this" keyword when you're adding a function to the prototype, it's only in the class definition where you need to have a clear reference to the object. After correcting that, I still get an error because you haven't defined "event" yet.
  2. There might be confusion as to what "this" is referring to because it's inside a function that could be called from any context. Here's the solution: Make an internal variable that is explicitly set to "this" when the object is created and use that variable to refer to the object. You also forgot to define the variable "event", it should be the first parameter of the click event handler. function matej(element) var self = this; // Reference to the object // ... self.longIt = function() { for (var i = 0; i < self.children.length; i++) { self.children[i].onclick = function (e) { // Added event object. Called it "e" so it won't override global variable "event" that IE needs e = e ? e : window.event; // Compatibility for Internet Explorer var x=self.after.indexOf(e.target.innerHTML); alert("!as"); } } } // ...}
  3. You'll need to learn programming, specifically Javascript. This isn't a 10 minute-task either. To build a robust application with your specifications I'd give myself at least a week for the duration of the project.
  4. Unless you can somehow isolate the thumbs of the last row you have to choose between all of them to the left or all of them centered.
  5. Perhaps you can use PHP as a proxy. You would need a local PHP file that reads the image data from the remote server and outputs it as an image.
  6. Set text-align: left on the element containing the thumbnails. Right now the .content_container selector is setting text-align to center.
  7. This probably happens if you're loading images from another domain name.
  8. Your button is an element. It's a <button> element because you defined it with createElement("button"). You need an <a> element in order to use the href and download attributes. You could make it an <a> element like this: var button = document.createElement('a');element.appendChild(button); You can use CSS to style it and make it look like a button visually.
  9. The problem in this thread isn't about building a referrals system, it's about installing a drupal plug-in. Read installation information about it here: https://www.drupal.org/project/referral
  10. If the buton is an <a> element you can use the download property. button.href = canvas.toDataURL("image/png");button.download = 'file.png';
  11. You'll have to program PHP to choose a random image each time the page loads.
  12. While( !i ) is going to continue running the code until i has a value which isn't false, 0 or an empty string. What they're actually doing is halting the program until jQuery has loaded. This is probably not a good idea: If jQuery takes long to load the browser will freeze.
  13. It's called a callback function. Something else is calling the function and passing the arguments to them When you call array.sort(), internally the function you gave it is being called and it is being given two elements of the array. I don't see where showPosition is being called. Here's an example of what a function that uses the callback looks like: // This is the callback functionfunction callback(a, { return a + b;}// You pass the callback function to this function.// Normally we don't see the source code of this one which is why it looks like no parameters were being passed.function useCallback(c) { return c(1, 2);}// Let's try it out:alert( useCallback(callback) );
  14. According to Google Fonts, Titillium Web only has support for "Latin" and "Latin Extended" character sets. It means that the font author did not draw all the characters you want to use. Maybe Internet Explorer automatically chooses a different font if the characters aren't found, but the standard thing to do is to display a placeholder, like a box or question mark. I recommend that you use a different font on elements that are going to have Arabian text in them. If you're selecting a font from Google fonts, look at the character set options for the font.
  15. JSON and XML are not products. The creator of JSON has absolutely nothing to gain by having people use the format, he's promoting JSON for the benefit of the developer community. JSON is a benefit to programmers and developers for being much easier to work with and taking up much less memory. XML is only a standard because it's been around for longer. The W3C takes years to make simple decisions, as an organization it's pretty inefficient at getting things done. Between 1999 and 2008 the W3C hardly managed to get anything done at all. The reason we have HTML 5 and CSS 3 now is because one group of people who didn't like the way W3C was functioning broke apart from it and created the HTML 5 standard on their own, that's when the W3C finally decided to start getting back to business. JSON is so short and simple that it doesn't even need to be a W3C recommendation. Its grammar is so simple that it can be represented in the sidebar of a website http://www.json.org/ On the other hand, here's the document needed to describe XML: http://www.w3.org/TR/REC-xml/ In the case of sending data from the server to the client for Google Maps, JSON is much better suited. It takes less bandwidth and accessing its data in Javascript is much easier.
  16. 1. When Javascript sets display to an empty string, the element takes whatever value the CSS was giving, which is "none" in your case. If you want to override the CSS you'll have to set it explicitly to "block", "inline", "table" or whatever type of display the element is supposed to have when it's visible. 2. Make sure that the script is being called after the element has loaded. The <script> tag should be further down in the document than the element it is referencing. 3. Yes, PHP can send data to Javascript. The reason that script wouldn't work is firstly because of what I said in point 2. Secondly, you're using the assignment operator "=" when you should be using the comparison operator "==" in your if() statement.
  17. Instead of using style.visibility, use style.display as I mentioned in my previous post.
  18. Discussion for this can continue in the other thread: http://w3schools.invisionzone.com/index.php?showtopic=51698
  19. I'm not sure if you understood. The browser runs the code in the order it is found, which is why order matters. I can't guarantee that this is the only problem you have to solve, but it's one of them. Rearrange this: <script src="/js/jquery-ui-1.8.15.custom.min.js"></script><script src="/js/jquery-1.6.2.min.js"></script> to this: <script src="/js/jquery-1.6.2.min.js"></script><script src="/js/jquery-ui-1.8.15.custom.min.js"></script>
  20. You might want to research (using search engines) to see if there are language packages for that plug-in or to see how other people did it. Often the code that writes out the HTML for the plug-in is embedded deep within a lot of PHP.
  21. You can use AJAX to load information from a text file. In that case you won't need the "&q=" part. If you are curious about query strings you do have to learn PHP.
  22. Ingolme

    arrays ! help

    In what way do you want the data put into the array? You could append the entire $file array as an element of $array1. $array1[] = $file; You could add each element in $file as an element of $array1. foreach($file as $element) { $array1[] = $element;} Maybe you want $array1 to be an element in the $file array instead. I don't know, you haven't described your data structure well enough for me.
  23. This is quite advanced. A "group" in this context is a page that can only be accessed by a certain set of members. So first of all, in our database we would have a groups table and a users table. Groups have an ID, name, etc. Users have an ID, name, etc. Then we would have a relationship between a groups table and the members table. One feature of that relationship would be the status of the member in that group, so we would need a table that associates groups and users with a status as well, such as this: GroupID | Status | UserID ---------+----------+--------- 1 | Member | 3 1 | Admin | 1 1 | Member | 2 :: User 1 is an admin of group 1, users 2 and 3 are members of the group Then there's an entire set of tables dedicated to adding discussion threads, comments, widgets and articles to the group, which is a massive project in itself. A project of this sort could be worth tens of thousands of dollars to create, and that's my lower-range estimate.
  24. I see. They could also have used JSON to send the data instead of XML but JSON was not so popular in 2007 as it is today. To do it with JSON you would use json_encode() in PHP to send the data and then decode the responseText it in Javascript with JSON.parse() Yes, it's possible to have a PHP page write out the Javascript, but it's much messier and harder to maintain. I don't think you'd find a pre-made script for that, you'll have to write it out yourself. Loop through your database data and start printing Javascript statements that create new google.maps.Point() and google.maps.Marker() objects.
  25. Can you show some of the sources that are recommending XML? I haven't worked extensively with Google Maps, but I suspect they have a good reason for using XML. XML is really easy to learn, there's nothing to memorize except a very simple syntax. Google Maps is entirely Javascript-based so there's no way you can avoid having to use Javascript.
×
×
  • Create New...