Jump to content

Ingolme

Moderator
  • Posts

    14,901
  • Joined

  • Last visited

  • Days Won

    177

Everything posted by Ingolme

  1. You can't wrap tables inside a <p> element. <p> specifically indicates a paragraph, with text in it. A table stands on its own, it doesn't need to be wrapped. What browsers do when you try to wrap a table or block-level elements in a <p> tag is to close the <p> element first, then load the next element outside of it. You forgot to close your </table> element, which is why the <p> element that's following it is not being rendered in the right place. Make sure your code is valid using the HTML validator: http://validator.w3.org/ It is very important to have valid code so that CSS and Javascript will work properly.
  2. It works, but it's not the best HTML, and the IDs are invalid. You can put IDs on headings or any other element, it doesn't have to be a span. You probably don't need a strong tag there, if you want bold text then use CSS. IDs cannot have spaces, so change it for underscores, hyphens or dots. Check your code in the HTML validator. Here's a little better: <ol> <li> <h3 id="Help-Members">Help Members</h3> -- and there's some other info here <p>first paragraph first item</p> <p>second paragraph first item</p> </li> <li> <h3 id="Write-Tutorials">Write Tutorials</h3> -- and there's some other info here <p>first paragraph second item</p> <p>second paragraph second item</p> </li></ol> Remember you can change anything and everything about the appearance using just CSS.
  3. It sounds like you're not running this on a PHP-enabled server or you forgot to save the file with a .php extension.
  4. There are jQuery plug-ins to make date pickers, you could research those.
  5. If you don't want to redirect you'll have to use Javascript and AJAX. I understand what you want, but what part of your code is not working?
  6. This is what I mean: @font-face { font-family: Tahoma; src: url(../font/Tahoma.ttf );}@font-face { font-family: Homa; src: url(../font/Homa.ttf);}@font-face { font-family: Yagut; src:url(../font/Yagut.ttf);}@font-face { font-family: TitrBold; src:url(../font/TitrBold.ttf);}
  7. So where is the problem? I see you have a few variables that are not being used anywhere, namely $width, $height and $form. PHP scripts only run as the page loads, if you want to run them again you have to load the page again. This isn't valid HTML <td><id="zipcodeError" value='' class="zipcode_button"/></td> A <td> element shouldn't be here, and the other element <id="zipcodeError"> does not have a name.
  8. I think you need to wrap each font in its own @font-face ruleset.
  9. I created a linked list for one of my projects because an ordinary array was too costly to navigate for what I was using it for. The DOM itself is a large tree/list structure and understanding algorithms is important if you want to navigate the tree either iterating or through recursive functions. In Javascript, properties that contain arrays or objects are like a pointer (it's called a "reference" because you can't actually manipulate the value of the pointer itself).
  10. Most books on the subject will not be specifically for Javascript. Just learn the concepts in general, they're useful for any language. I learned from university and my own experience so I don't know any books in particular.
  11. Yes, you do. Javascript is no longer just a small scripting language to make flashy effects on a website, it's pretty much a full programming language in which you can make virtually anything. Applications such as Office365 and Google Docs are made in Javascript and there are entire videogames made with it these days. If you just want to make a few effects on your websites you don't have to learn algorithms and data structures, but if you actually want a job as a Javascript programmer for any company then you really need to know these.
  12. You probably shouldn't be loading the entire page. Have an element with a particular ID in it and use that to load the content contained inside it. The jquery .load() method allows you to load content from a particular ID using this syntax: .load("acman.php? #content") Then all you need to do is change the function so that instead of loading a fixed filename it toggles between the two filenames. .load(file + " #content")
  13. When submitting the form, you'll have to get the value from both fields (with the value property element.value), compare them both and if the second one is less than the first one then prevent the form from being submitted and show an error message I'm not sure in what format the date field stores its value, you'll probably have to break it into pieces using the substr() method and then create Date() objects for each one to compare them.
  14. Which element are you talking about?
  15. Nothing can be inside an <ol> element except a <li> element. It's invalid to put <p> elements there. Put them inside the <li> elements instead. Here's a valid structure: <ol> <li> <h3>first item <span> -- and there's some other info here</span></h3> <p>first paragraph first item</p> <p>second paragraph first item</p> </li> <li> <h3>second item</h3> <p>first paragraph second item</p> <p>second paragraph second item</p> </li></ol>
  16. If they're actually using the real IE8 and not trying to emulate it then they won't encounter the problem. It's just your developer tools that work that way.
  17. Open the developer tools, change browser mode and document mode to IE8, then open the console tab of the developer tools and reload the page to check for any errors. Make sure you're testing the page on a server, like localhost.
  18. The newer version of Internet Explorer doesn't make a distinction between browser mode and document mode, you probably should change your browser mode to match the document mode when testing and be sure you're testing standards compliant document mode. What's the URL of the page you're testing? Did you check the console for errors?
  19. I don't see a "browser mode" option in the developer tools. The document mode option is the only one I can see here where different versions of IE can be tested.
  20. I'm testing this in Internet Explorer 8 and it is working fine. Internet Explorer 7 puts the columns side by side as well, except that the third column doesn't fit so it's going below. IE8 and under won't work right on the filesystem, but they work when the page is uploaded to localhost or another server.
  21. You can't center things that are being displayed as a table cell. Set the display of #keypad to inline-block instead of table-cell, then set text-align to "center" on its parent element. If you need to, wrap the keypad inside another <div>
  22. No, it's not a server problem. Does your original code have a <!DOCTYPE> and <html> tag?
  23. The documentation for that game controller library doesn't seem to have a lot of information, they don't explain how it checks for keyboard mappings if it does at all. This script is working, I tested it in my Firefox's mobile emulator. Look through it and try to see what you were missing in your own attempts: <!DOCTYPE html><html> <head> <title>Game Controller test</title> </head> <body> <canvas id="game" width="800" height="600"></canvas> <script src="gamecontroller.min.js"></script> <script> // Constants var MIN_SPEED = 0; var MAX_SPEED = 20; var ACCELERATION = 0.5; var JOYSTICK_THRESHOLD = 0.2; var INV_FRICTION = 0.6; var BOX_SIZE = 40; // Game objects var canvas = document.getElementById("game"); var context = canvas.getContext("2d"); var inputBuffer = { up : false, down : false, left: false, right: false }; var box = { x : 400, y : 300, vx : 0, vy : 0 }; // The game loop function gameLoop() { setTimeout(gameLoop, 33); /* Check inputs */ // Vartical inputs if(inputBuffer.up) { // Move up box.vy -= ACCELERATION; } else if(inputBuffer.down) { // Move down box.vy += ACCELERATION; } else { // Vertical friction box.vy *= INV_FRICTION; if(box.vy < MIN_SPEED && box.vy > -MIN_SPEED) { box.vy = 0; } } // Horizontal inputs if(inputBuffer.left) { // Move left box.vx -= ACCELERATION; } else if(inputBuffer.right) { // Move right box.vx += ACCELERATION; } else { // Horizontal friction box.vx *= INV_FRICTION; if(box.vx < MIN_SPEED && box.vx > -MIN_SPEED) { box.vx = 0; } } /* Prevent the box from going too fast */ if(box.vx > MAX_SPEED) { box.vx = MAX_SPEED; } if(box.vx < -MAX_SPEED) { box.vx = -MAX_SPEED; } if(box.vy > MAX_SPEED) { box.vy = MAX_SPEED; } if(box.vy < -MAX_SPEED) { box.vy = -MAX_SPEED; } /* Update the box's position */ box.x += box.vx; box.y += box.vy; /* Draw everthing */ // Clear the screen context.clearRect(0, 0, canvas.width, canvas.height); // Draw the box context.fillStyle = "red"; context.fillRect(box.x, box.y, BOX_SIZE, BOX_SIZE); } // Initialize the controller GameController.init({ left: { type: 'joystick', joystick : { touchMove : function(data) { // Horizontal controls if(data.normalizedX < -JOYSTICK_THRESHOLD) { // Left inputBuffer.left = true; inputBuffer.right = false; } else if(data.normalizedX > JOYSTICK_THRESHOLD) { // Right inputBuffer.right = true; inputBuffer.left = false; } else { // Neutral inputBuffer.left = false; inputBuffer.right = false; } // Vertical controls if(data.normalizedY < -JOYSTICK_THRESHOLD) { inputBuffer.down = true; inputBuffer.up = false; } else if(data.normalizedY > JOYSTICK_THRESHOLD) { inputBuffer.up = true; inputBuffer.down = false; } else { inputBuffer.up = false; inputBuffer.down = false; } } } } }); // Begin the game gameLoop(); </script> </body></html>
  24. Strings wrapped in single quotes do not evaluate variables, they print out the literal $ and whatever follows it. If you want to use variables in your strings they have to be delimited by double-quotes.
  25. The bottom of what? In the page you're showing, the block is at the bottom of the page simply because it's the last element in the code so it goes below everything else.
×
×
  • Create New...