Jump to content

callumacrae

Members
  • Posts

    89
  • Joined

  • Last visited

Posts 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. Thanks Synook..That I know that VB Script only works in IE. However, I just want to know whether functionality wise, is there any difference between VB script and Javascript except that VB script works in IE only and Javascript works on every browser?
    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!
  3. Check O'Reilly, they are a well-respected technical publisher: http://oreilly.com/j...ript/index.html
    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 :D )
    The best book i found for in depth javascript is Proffesional javascript for web developer by wrox publication. It is not cookbook style book where it shows many real world examples but it is good for core language and it covers every topic from the basic. Along with this mozilla and opera developer network has large and good resource about JS.
    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!
  4. 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.

  5. iframes have their use, this just isn't one of them.
    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?
  6. On page 1 you will have to put your table inside a div. For example
    <div id="content">// Your table goes here</div>

    Then your JQuery will be

    $.get("http://mudsaf.info/games/index.php?pageid=2", function(responceData){$("#content").html(responceData);});

    responceData will be the data you echo-ed in your php script after you have tested that $_GET['pageid'] is equal to 2. You PHP script will have to be on the the index.php page but you can put it in a different page and and then change the URL to point to that page. I hope this way of sending an AJAX request is much more easier to digest.

    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.
  7. 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.

  8. 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:

    Home | About | Contact
    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/

    • Like 1
  9. 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.

  10. 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...