Jump to content

Ingolme

Moderator
  • Posts

    14,901
  • Joined

  • Last visited

  • Days Won

    177

Everything posted by Ingolme

  1. You don't need to load the page again to start the game over. Just give the game a reset() method which sets all the relevant values to their initial state. The method should: Set scores to zero Empty the cowpies array Set all the target isGood properties to false There's an easy way to reload the page if that's really the route you want to take to solve this problem. Use the location.reload() method: http://www.w3schools.com/jsref/met_loc_reload.asp
  2. That works. The biggest security vulnerabilities would be in the code that actually gives security_level a value.
  3. You should fix that syntax error. It's very important. Show us the code between lines 114 and 118.
  4. You could make the extension submit data to a mail form on your own website if you have one, but then you'll need to make sure your website is always available for the extension to use. Your mail form would also be open for anybody else to use as well.
  5. That doesn't really make sense. If you're reading the variable then you already know the name of the variable you just read. var garfield = "Gimme lasagne!"; alert("The variable name for " + garfield + " is garfield"); I'm going to need more context to fully understand your real requirements. You probably need a data structure similar to this: var quotes = [ { name : "Garfield", value : "Gimme lasagne!" }, { name : "Person", value : "Something" } ];
  6. Do you understand how this works? I'm trying to help you learn. At what point in the program's execution do you think the game is ready to start?
  7. PHP has to run on a server that has a PHP engine installed. It is a server-side technology. Browsers cannot send mail without the aid of a server.
  8. Where is game.start() called? If you don't call that method the game will not work.
  9. You probably did something wrong. If all you did was wrap the logic in an event handler it should work just the same.
  10. I think I know what the issue is. I thought you were referring to text below the menu on the page, but I now believe you were referring to the text inside the button. Since the button has increased in size, so has the text inside it, but when you scale something you have to scale it around a center point. If that center point were at the top left corner of the element then the text would appear to move down slightly when the text scaled up. Setting transform-origin to center should solve that problem: http://www.w3schools.com/cssref/css3_pr_transform-origin.asp
  11. I can't see anything in the code that might be causing that. I need to see it working in the browser. Just a tip, you can combine selectors with the comma so that you don't have to copy and paste the same CSS rules over and over. In your current page, this would be an example (but I already provided a better HTML structure so this rule should not be used) #textnav:hover,#textnav1:hover,#textnav2:hover,#textnav3:hover { color: white; -moz-transform: scale(1.1); -webkit-transform: scale(1.1); -o-transform: scale(1.1); -ms-transform: scale(1.1); transform: scale(1.1); transition: .3s ease-in;}
  12. I can't really tell from this code, it looks correct to me, I would have to see the actual page in my browser to find out what styles are being applied to it. I think you may be adding a border on hover. You need to improve your HTML. You're using whitespace for layout, that's a bad practice, if you need space between elements use margin or padding. You also have too many IDs, they're not necessary. IDs should denote important elements on the page. This would be a better structure for your HTML. Clean and semantically correct. <nav id="navigation"> <ul id="menu"> <li>Rocks</li> <li>Minerals</li> <li>Locations</li> <li>Identification</li> </ul></nav> You can use CSS to make it look however you want: #menu { padding: 0; /* Remove <ul> default padding */ list-style-type: none; /* Remove bullets */}#menu li { margin-bottom: 3.3em; /* This replaces the <pre> elements */}#menu li:hover { color: white; -moz-transform: scale(1.1); -webkit-transform: scale(1.1); -o-transform: scale(1.1); -ms-transform: scale(1.1); transform: scale(1.1); transition: .3s ease-in;}
  13. My guess is that upon creating the sprites the images haven't been loaded yet, so they have a width and height of 0. That can be solved by wrapping the entire logic section in a function and set a window load event to call it. Remember to remove the window load event that's currently being used for game.start. /***********//** Logic **//***********/window.addEventListener("load", setup, false);function setup() { /** All logic here **/}/*************//** Objects **//*************/// The rest of the code
  14. Step 1: Prepare your HTML <ul class="tab" id="tabs"> <li><a href="#London">London</a></li> Step 2: Assign event listeners in your Javascript file. (addEventListener assigns events to elements without cluttering your page's HTML) var links = document.getElementById("tabs").getElementsByTagName("a"); for(var i = 0; i < links.length; i++) { links[i].addEventListener("click", openCity, false); } Step 3: Get the data from the link that was clicked in the event handler. (Learn about the hash property here: https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement ) function openCity(evt) { // Get city name from link var cityName = evt.currentTarget.hash.substring(1); // Declare all variables var i, tabcontent, tablinks;
  15. You can use a margin, but normally for vertical spacing between elements you use pixels or ems. 70% margin is large and it's relative to the width of the container, it doesn't make a lot of sense to use it as a vertical margin.
  16. Do you really need that much space between the video and the text box above it? It looks poorly designed if you ask me. With your current HTML setup, they should already stack vertically without a problem, you don't even need a margin.
  17. I see it now, they didn't exactly make it easy to find. That's text on the same element as the faded overlay. The element has a background color and text in it and it just changes its opacity to 80% when hovered. It's stretched to take up all the space within its container.
  18. You have two elements with the same ID. That's not going to work. <text> is not a valid HTML element, either, try <div> or <span> depending on if you want a block or an inline element. <img> does not have a closing tag. It should have a src and alt attribute even if they're blank, those can be changed later with Javascript if necessary.
  19. I'm not sure what your requirements are. You can use a margin, I just don't think a percentage value is what you need. I would need to know exactly what your requirements are. How far from the top should the video be?
  20. Percentage values for margin are relative to the width of the container, even vertical margins. The wider the container is, the further down from the top your video will be. Is this really the behaviour you want?
  21. I'm not seeing any text appear, all the text is already visible from the start. If you want text to appear you can have an element with opacity: 0 and change the opacity to 1 to make it visible.
  22. I don't think you understood the foreach() loop. You have this: foreach ($checkbox as $value) { But you're not using $value anywhere.
  23. From the code you provided earlier, it seems you have applied the same ID on two different elements. This is forbidden, the ID should be unique in the whole document. <div id="Geodevideo"> <video controls="controls" id="Geodevideo" poster="picofrock.png"> <source src="Geodes.mp4" type="video/mp4"> Your browser does not support the video tag. </video> </div> Because the same ID is on two elements the selector is ambiguous now, each browser can choose how to handle this issue. They might apply the style to both elements, just one of them or to none of them.
  24. Calling date_default_timezone_set() will work as long as you provide a valid timezone and you called it before any date () calls. I recommend putting it at the beginning of the file.
×
×
  • Create New...