Jump to content

Ingolme

Moderator
  • Posts

    14,901
  • Joined

  • Last visited

  • Days Won

    177

Everything posted by Ingolme

  1. Your function is also missing a closing curly brace.
  2. In your case, data is just a string. To convert it to a Javascript object you can use JSON.parse(). stored_houses = JSON.parse(data); jQuery has a method that automatically parses JSON received from a request. http://api.jquery.com/jQuery.getJSON/
  3. This is Javascript. It only runs on the client. All the values it gets and uses are on the user's computer.
  4. You'll need yet another localstorage variable to remember which value it had two iterations before. Then when you generate the current price you need to compare it to the previous one to decide which value to show. Onchange does not work like that. The onchange event fires when a user changes the value of a form element.
  5. Your original post says that you wanted the size of the div. The offsetHeight property tells you the vertical size of the div even if it has expanded to contain more content. Since the div expands with the content, its height is also the same as the height of the content that's within it.
  6. The offsetHeight property will tell you the height of the element.
  7. Where is the variable "abc" being set?
  8. Check what value abc has: if (abc == "m³") { var variable = "m³"; document.getElementById('show').innerHTML = variable;} else { // Why isn't it working? alert(abc);}
  9. Open your text editor and figure out what encoding the page has. It should be UTF-8. If it's ANSI or something else then you need to change it.
  10. If you're using the <select> dropdown list. What you can do is make the value of the <option> element a string that's easier to work with. For example: <option value="m3">m³</option>
  11. Here's the tutorial page for the ORDER BY keyword: http://www.w3schools.com/sql/sql_orderby.asp Usually when you retrieve the data you would order by date in descending order.
  12. There are examples right on the localStorage page at MDN: https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API/Using_the_Web_Storage_API In your case, what you have to do is first show the value of the stored data and then change it after. // First show the stored valuedocument.getElementById("previous").innerHTML = localStorage.getItem("previous");// Then change itvar price = Math.round((Math.random() + 1)*100)/100;document.getElementById("price").innerHTML = price;localStorage.setItem("previous", price);
  13. Do you know how to assign event handlers and do you know how to store values using localStorage? How much Javascript do you know?
  14. Going by this W3Schools example I think maybe including the root node in the selector might work: <xsl:for-each select="master/customer"> It's been years since I last used XSLT, so I'm not sure. And it might be that the PHP library works a little bit different than browsers do. Unfortunately, our resident XML expert hasn't been on the forums for a couple of years.
  15. CSS isn't programming. It's actually unimaginably simple compared to programming. There are two ways to learn and you can do both at the same time: 1. Go to college or university 2. Do research and think through problems.
  16. The property name is margin, not marge. Setting the margins to auto will only work if the element has a defined width. If you're trying to center inline elements or inline-blocks then just setting text-align to center should work.
  17. Do you know CSS? If you wrote it, then it should be obvious which selector is targeting which element. If you didn't write it, you should be able to know which element is being targeted based on the selectors in the stylesheet. If you don't know CSS then read the tutorials: http://www.w3schools.com/css/
  18. Your understanding of the logical operators is incorrect. This is an application of De Morgan's laws: http://en.wikipedia.org/wiki/De_Morgan%27s_laws If you were not negating the inputs then the result would need the OR operator. Let's assume these conditions: P: sexo == "h" Q: sexo == "H" R: sexo == "M" S: sexo == "m" These would be the negated conditions: ¬P: sexo !== "h" ¬Q: sexo !== "H" ¬R: sexo !== "M" ¬S: sexo !== "m" This is the correct answer that the user should provide: P || Q || R || S The while loop is checking that the user gave the incorrect answer: ¬(P || Q || R || S) which, due to De Morgan's law, is equivalent to: ¬P && ¬Q && ¬R && ¬S
  19. You have a whole lot of scripts running on the page. My browser stopped listening to clicks and keystrokes on your page at one instance and I had to refresh. What I've found is that the <textarea> element that your TinyMCE editor is attached to does not get the value until after your submit handler has worked. It seems that TinyMCE has a submit handler as well and that its handler is only being executed after yours is. My proposed solution is to read the documentation to see if TinyMCE has a feature that lets you tell it when to fill in the textarea, then put that into your submit handler.
  20. To answer your first question, the reason is to make sure they've given a proper answer and not letting them continue until they do. The only answers allowed are "h", "H", "m" and "M", if other answers are given they're asked the question again. The answer to your second question is logic. You only want to ask the question again if all four of the conditions are met. The conditions being that the answer is not "h", not "H", not "m" and not "M". If you used an || operator then the condition is always met, since at least one of the four conditions is always true. If it's "H" then not "M" is true, if it's "M" then not "H" is true.
  21. A normal way to delete cookies is to change the expiry date to sometime in the past. That's how it's done in PHP. I'm not sure of the rules Javascript uses. Here's the correction to the line of code I mentioned in the previous post. document.cookie = "username=;" + expires;
  22. Ingolme

    Error in Google

    Well, I'd start by removing the vertical pipe from that selector. Other than that, I do not have sufficient information to devise a proper solution. As I mentioned in my first reply, without knowing the actual HTML structure of the page I can't know what the CSS is doing. It would be most helpful if you could show the problem on an actual page so I could see the problem in my browser. The problem most likely stems from positioning, so if you want to try fixing it yourself go through your code looking for position: absolute or position: relative and see which elements they're being applied to. Did you write all the CSS yourself?
  23. You forgot to add the expire date onto this string: document.cookie = "username=;expires"; All you did was put the word "expires" without any date on it.
  24. Ingolme

    Error in Google

    The * selector targets everything on the page. It's unnecessary because the class and ID selectors already do that without needing the * next to them. This selector looks like it will present a problem: *.nrg-title > |a The vertical pipe is not a valid selector and some browsers might ignore that rule. When I'm talking about absolute and relative positioning I'm referring to elements with the rule position: absolute; or position: relative; along with top, bottom, left or right rules. This causes elements on the page to overlap. If something's overlapping this is most likely the cause of it. This way of positioning is unnecessary for ordinary page layouts and can really mess things up.
  25. Yes, they're both in the same subnet, but they're two different addresses that would point to two different computers.
×
×
  • Create New...