Jump to content

callumacrae

Members
  • Posts

    89
  • Joined

  • Last visited

Everything posted by callumacrae

  1. That errors means that you have space between attributes and you shouldn't have. If you can't fix it yourself, could you post the code in question, please? Just that link and a couple lines around it should do the trick.
  2. Oh, I forgot about file uploads. Don't know anything about the second, though.
  3. I don't know whether it counts, but there are no jobs in VBScript; everyone stopped using it years ago (it was never that popular in the first place, either). Microsoft no longer support it, and if I recall correctly, they even recommend that you use JavaScript (I can't remember where I saw that, though). EDIT: Sorry, only read last post date, didn't read date of OP. I blame James!
  4. I guess it depends on whether you're going for correctness, or ease of use and the ability to make your website look the same across all browsers.
  5. This. In my experience, O'Reilly are the best publishers. I've written a book and had it published through them, and they certainly would not have let any bad content through. (note: my book is one of the first ones on that page ) It specifically says "This book is not aimed at beginners who lack a basic computer science background or those looking to add some simple user interactions to web sites. These readers should instead refer to Wrox’s Beginning JavaScript, 3rd Edition (Wiley, 2007)." You should not be recommending a non-beginners book to a beginner. Zakas is awesome, but not yet!
  6. Facebook is one of an increasingly large number of website which does not support users with JavaScript disabled. As Ingolme pointed out above, you can have the link point to a real page to edit the post for use as a fallback when JavaScript is disabled, but often it simply isn't worth it; if you don't anticipate a large amount of traffic with JavaScript disabled, then you can put up a banner saying that your site doesn't function 100% correctly with JavaScript disabled and leave it as that.
  7. I have never seen an iframe used in a professional situation, and it's my job to look for stuff like that. What is a use of an iframe?
  8. There is a function designed to do this: http://api.jquery.com/load/ Also, it is spelled "response". It's pretty important to spell variables correctly so that people reading you code stand a chance of remembering your variable names.
  9. You should never, ever use an iframe. This is one of the reasons why.
  10. If not working in Chrome and working in IE, it's usually IE not erroring when it should be (or an error in your install of Chrome). You haven't given use enough to go by so we can't help. What happens in other browsers? Also, you should send the charset in an HTTP header, not inline. Most servers do it for you anyway.
  11. Aaand here's a practical application which I have used it for before. The above example is using :before incorrectly and should be ignored; you should just be adding that to the source, as you shouldn't be using CSS for content, only styling. Say we have a list of links which we want to be separated by a "|" symbol: We have the following HTML source: <ul id="menu"> <li><a href="#">Home</a></li> <li><a href="#">About</a></li> <li><a href="#">Contact</a></li></ul> Hard coding the pipe symbol would be ugly and tricky to maintain. We can use the following CSS: #menu li { display: inline;} #menu li:not(:first-child):before { padding-left: 6px; padding-right: 10px; content: '|'} We now have what we wanted in the first example. JSFiddle: http://jsfiddle.net/c2U3y/1/
  12. Why can't you just use the normal jQuery method for detecting clicks? $('button#start').click(function () { // Do stuff here});
  13. You shouldn't really be opening new windows, that stopped being good practice years ago. Instead, do something like have a model pop up in the current window (something similar to a lightbox, but with text). You also shouldn't use document.write, as it can cause a number of problems and behaves different depending on what stage of loading the page is at. You should use document.createElement or jQuery to create the element, popular it, and then add it to the page. It's a lot easier with jQuery, so I'd recommend using it here.
  14. Say you have your list of URLs: var urls = [ 'http://google.com/', 'http://example.com/', 'http://example.com/google']; Retrieve the contents of the two inputs (I'm assuming you know how to do that; if not, look up the .value property), and use .indexOf to see whether the string is contained in the URLs. Clone the array, then cycle through it removing all elements which do not contain the "include" value and do include to "exclude" value. You'll end up with something like this: var urls = [ 'http://google.com/', 'http://example.com/', 'http://example.com/google']; $('#include, #exclude').keyup(function () { var include = $('#include').val(), exclude = $('#exclude').val(), newUrls = urls.clone(); for (var i = 0; i < newUrls.length; i++) { if (newUrls[i].indexOf(include) === -1 || newUrls[i].indexOf(exclude) !== -1) { newUrls.splice(i, 1); i--; } }}); Untested. There are a number of improvements that could be made (such as only retrieving the .val() of the updated input, or looping backwards to remove the i--), so when you understand everything that is there, see what you can improve. EDIT: How do I do inline code?
×
×
  • Create New...