Jump to content

Ingolme

Moderator
  • Posts

    14,901
  • Joined

  • Last visited

  • Days Won

    177

Everything posted by Ingolme

  1. You don't need </img>, you just need to put the closing angle bracket: <a href="about.htm"><img src="button.jpg"style="border:none"></a><a href="contact.htm"><img src="button.jpg"style="border:none"></a>
  2. There is no need to put a semi-colon for one CSS declaration. The semi-colon is a separator, not a terminator, so it's only needed to separate statements if you have more than one. The unclosed <img> tag is clearly the reason of the styles leaking onto the rest of the page.
  3. The <div> that the image is inside is floated to the right. The image is within the bounds of the <div> that contains it and can not be any further left than the left edge. You can either put the image outside of the div, or remove the "float: right" rule from the #navcontainer div.
  4. Any amount of styling on the div or image could be causing it. Show the HTML and CSS that you are using.
  5. I moved the thread to the XML forum, but I can't help you any further until I know what languages or tools you're using to edit the XML.
  6. Have you checked the error console? toFixed() turns the number into a string, you should only do that if you want to display the value in a readable format. It would be best if you operate in milliseconds instead of dividing by 1000. You only divide by 1000 to show a more understandable number to the user, but it's far more efficient to operate in the environment Javascript uses. // Global variablesvar timeSinceLastBeep;var timeStarted;// Function to be called on each framefunction instance() { // What time is it? var now = (new Date()).getTime(); // Make sure the timing variables have a value if(!timeStarted) timeStarted = now; if(!timeSinceLastBeep) timeSinceLastBeep = now; // Determine how much time has passed since the last beep var elapsed = now - timeSinceLastBeep; // If the amount of time that has passed is one second or longer then play a beep and remember when the beep was played. if(elapsed >= 1000) { beep(); // Set "timeSinceLastBeep" to the time when the beep should have played to prevent synchronization errors then = now - (timeSinceLastBeep % 1000); } // Show the amount of time that has passed var timeSinceStart = (now - timeStarted) / 1000; display.value = timeSinceStart.toFixed(1); // Call the next frame timeout = window.setTimeout(instance, 50);}
  7. That's the symptom of an unclosed tag. Most tags in HTML need a closing tag, such as </b>, </i>, </a> or </p> Make sure your HTML code is valid to ensure that your page displays properly. You can use the W3C validator: http://validator.w3.org/
  8. Where did that picture come from? It looks kind of like some of the data is corrupt.
  9. Are you using any language in particular? This is in the Schema forum, but Schema can only describe XML documents, not modify them. Perhaps you can just manually edit the file.
  10. You can have your function return an array, but unless you're operating a and z together in two different ways, I don't see a reason to do it. Returning both values with an array: function val(a, z) { return [ a/2, z+8 ];} A better approach: function half(x) { return x/2;}function plus8(x) { return x + 8;}
  11. Just for the sake of avoiding giving the garbage collector too much work, I would move the var snd = new Audio() line outside the function so that it can be reused over and over. I think mobile devices should be able to accept data URLs, but I haven't tested before.
  12. I don't know if it's commonly known, but articles can have a header and footer as well. Such that the structure could be something like this: <article> <header> <h2>This is the News</h2> <p>Posted on <time datetime="2015-01-01">January 1st, 2015</time> by <b>Ingolme</b></p> </header> <section> <h3>Part 1</h3> <p>Multiple paragraphs</p> <p>Multiple paragraphs</p> </section> <section> <h3>Part 2</h3> <p>More paragraphs</p> </section> <footer> <h3>About the Author</h3> <p>The author of this article has been writing this article</p> </footer></article>
  13. They are both correct. A website may have a section containing articles, or an article may have multiple sections. You need to judge which is the way that best suits the content on your website. It's even OK to have a section containing articles where those articles are further divided into sections.
  14. You're going to have an error of anything up to 100 milliseconds if you use Javascript's traditional timers setInterval() and setTimeout(). If you use requestAnimationFrame() you can reduce the error to under 16 milliseconds. The script from my post will have these tiny errors in the exact moment a beat is played, but it will be generally synchronized because it's using the Date() object. I chose an interval of 50 milliseconds because your timer only needed a precision of 100 milliseconds. From my experience, these are not enough for music playback. Recently I have been working on a music application in Javascript and during my search for perfect timing I came across this great article: http://www.html5rocks.com/en/tutorials/audio/scheduling/
  15. I wouldn't use a closure for that. If I wasn't trying to keep the code similar to his original idea I would have created an object Timer and given it properties and methods.
  16. Ingolme

    curl

    That username and password is for HTTP authentication, which is not the same as logging into a website. The server you are trying to log into does not use HTTP authentication.
  17. Indent your code properly Don't use <form> tags if you're not submitting anything to the server Keep track of all your timers You have to use proper DOM methods to access elements like getElementById() and getElementsByTagName(). formName.elementName is non-standard and may not work properly in all browsers. Check the Javascript reference for any functions that may help you. Number.toFixed() simplifies the code a lot. Try to keep your code as short and simple as possible. Read this and try to understand how it works. It should be easy because I've cut out a whole lot of stuff from it and made it really short: <fieldset> <label> <span>Seconds:</span> <input type="text" id="counter"> </label></fieldset><fieldset> <button id="start">Start</button> <button id="stop">Stop</button></fieldset><script type="text/javascript">// HTML elements we're going to usevar startButton = document.getElementById("start");var stopButton = document.getElementById("stop");var display = document.getElementById("counter");var timeout; // Global variable for clearTimeout();var startTime; // Global variable to remember when the timer started// Event handlersdocument.getElementById('start').onclick = start;document.getElementById('stop').onclick = stop;// Start the timerfunction start() { startTime = (new Date()).getTime(); instance();} // Stop the timer function stop() { if(timeout) { clearTimeout(timeout); timeout = null; }}// Call this on each intervalfunction instance() { elapsed = ((new Date()).getTime() - startTime) / 1000; display.value = elapsed.toFixed(1); // Remember that "display" was defined at the beginning of the script timeout = window.setTimeout(instance, 50);}</script>
  18. You should call clearTimeout() when you want to stop an existing timer. Here's how it works: var timeout = setTimeout(callback, time);// When you want to stop the timer:clearTimeout(timeout); With your current code, you'll have to watch carefully for the scope of the variables you're using. If you use var timeout right inside the function it won't be accessible to clearTimeout() outside the function.
  19. HTML 4.01 and even 3.2 are also capable of being mobile-friendly. I dislike people using "HTML5" as a buzzword for all modern front-end techniques.
  20. Have you checked to see if there are any error messages in the console? If you use addEventListener you will make sure other scripts can't override your event listener. It's also unnecessary to wrap your function inside another one. Instead of: window.onload = function() {function_1();} It should be: window.onload = function_1; And if you want to prevent conflicts with other scripts: window.addEventListener("load", function_1, false);
  21. The simplest form of templating is just using PHP include() to load a piece of code into multiple pages. There are more complex ways to do it for larger websites.
  22. You need a server-side language such as PHP in order to create a templating system.
  23. The Google ranking depends on a whole lot of factors. Perhaps other sites you're competing with have done a lot more to improve their rank. It's very important to have good quality links to your website from other sites, make sure your HTML is valid and well structured. Google ignores the meta keywords list, but a good <title> and meta description will tell Google about your website. A proper HTML structure makes good use of <h1> to <h6> elements and paragraphs.
  24. W3Schools is promoting it because they created it. Use it if you think it fits your needs. You need to differentiate between client-side AppML and server-side AppML.
  25. If you're using AppML just for Javascript on the client side, you shouldn't need a config file, but if you're using PHP then you will need it regardless of whether you intend to use a database or not. For the AppML Case examples, don't follow the WebMatrix tutorial page because that involves server-side AppML. Just copy the code from the tutorial and substitute appml.php for a file that contains the AppML model.
×
×
  • Create New...