Jump to content

Jack McKalling

Members
  • Content Count

    1,606
  • Joined

  • Last visited

Community Reputation

2 Neutral

About Jack McKalling

  • Rank
    Dedicated Member

Previous Fields

  • Languages
    PHP, (x)Html, CSS, JavaScript, XML, MySQL, C#, Java, RegExp

Contact Methods

  • Website URL
    http://

Profile Information

  • Gender
    Male

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. The javascript reference contains pages for all object types, like Array, Boolean, Date, Math, String. But not Object itself. There is a page for "Global" properties and functions, "Operators" and "Statements", but things like Object.create(), Object.values(), Object.keys() etc aren't on any of those pages either. Are these methods not documented because of lack of support on W3Schools for the relevant javascript version, or can Object be added to the reference pages? I'd like to see Object documented here, and not need to go to the MDN. Thanks for letting me know *Edit: I phr
  2. For some reason the W3Schools website is not reachable in IE8. It simply gives a direct HTTP error and I cannot view any page. However the forum works just fine, but that is on a different domain anyway. Why is this? Is this a decision from W3S, to kick browsers that are too old, or is it some browser setting I myself overlooked? Because I find it very weird that W3S, who themselves are teaching how to be cross-browser, are not even compatible at all with this one. I was just trying to figure out whether I should be using the "lightgrey" or "lightgray" colourname, and I know IE8 is the
  3. Hey, wonderful! New wow looks
  4. So you see, it all comes down to our definition. I never really agreed with wikipedias statement there because I thought OOP was only really a meaningful term if it is distinguised from classless programming (most languages work with objects anyway). This prototyping of JavaScript is quite different from my definition here, and though both methods could have their pros, I think I prefer the latter. But I don't want to start a discussion on which is better, I only need to point out I should have phrased myself from the start. Like this:Programmers who are (only) used to define classes like in e
  5. From my definition, prototyping has nothing to do with OOP. It may provide a means to create objects and such, but does this mean it is OOP? As previously mentioned JavaScript saves almost anything as objects. But compared to Java, C#, or even PHP's OOP implementation, JavaScript really isn't object oriented, right?Though it's often proven that some of my definitions are somewhat off to what's usually accepted, and that may apply here too. But it doesn't mean I never have my reasoning. I might seem off or backwards, and you're probably right, but when I mention OOP, I refer to using class defi
  6. @ShadowMage,The reduction in parameters is what I also had in mind, but I thought just to first show the idea of parametering what was already global. I didn't know setTimeout() also accepts an anonymous function though, thanks! The tutorial doesn't explain the type of that argument quite clearly (they call it a "reference", but use a string in their own example). And what stupid of mine, default values of parameters, lol. I haven't been using either PHP or JavaScript for a while now, obviously I'm mixing things up a little here.I fully agree with you that the custom function is confusing. If
  7. I believe you might write this function completely using parameters, eventhough you're using the setTimeout() function.Bear in mind the setTimeout() requires you to pass the function call as a string argument, as this means you can't simply pass in arguments to your function normally. You have to include the result of any argument into that string, which I present here: <script type='text/javascript'>//var text; //not necessary anymore//var texttobePlaced;//var theLoop = 0;function generateText(text="", textToBePlaced="", theLoop=0) { text = document.getElementById('thetext').va
  8. I don't know if global variables make your browser slow, but it does provide the certain danger of conflicts between scripts that you installed together. A global variable should not be used by multiple functions unintentionally, and if they are global, this is precisely what would be possible.In my opinion, it should always be visible where a variable comes from, and in what scope it is active. In OOP this is quite obvious if you fully qualify them, but in javascript, there is no such thing. So to keep things readable, I'd say just try to use just the one scope of every function, and not the
  9. That's right. I totally forgot about "normal use" of objects and assumed the use was referring to OOP.I think my only use for global variables is/was for preloading images with javascript, but then again, I don't use that anymore either because of the sprite-technique.My own reasoning behind not recommending global variables is that this scope is used to declare functions only, in the head section of your page. I see this section as a declaration of modules, and no actual execution of code.
  10. But I suppose if multiplication or addition is all you want, you probably don't need both of these values returned by the same function at the same time. For other cases, this is the way to do it though.There is another option to 'return' multiple values, but this is more like a hack and better done in OOP context.You can instead of hard returning a value, also change a variable or property that was created outside the function scope. If you change such a value from within the function, you don't need to return it from the function as it is already avaliable outside. This is not recommended pr
  11. Correct, the return-statement returns code execution, so really any code that follows it is skipped. You cannot return multiple values precisely because of this, the only way of doing so would be by combining the values in one value, like an array (like Deirdre's_Dad explains below). You can also make the calc(x,y) function callable with a third parameter that is of boolean value, to indicate whether you want to add or multiply, and return the appropriate value by conditioning on the value of this parameter. <head><script type='text/javascript'>function calc(x,y,multiply) {
  12. Just as I explained, the onsubmit handler is using a value. If you return false from it, it will of cource cancel the event, but if you only call a function, it will not, regardless of the return value of that function. Unless you RETURN the return-value of the function like in above example :)This might seem a little weird for you in the beginning. But this eventhandler is, if you want to know, a separate code scope from the event itself. It will only cancel the event if it returns a value, just like your function does. If the handler calls a function itself, the return value must be returned
  13. You'll also want to return the value of the function to the event itself, simply calling it won't be enough in my experience.Using your example, the code will look like the following, taking ShadowMage's correct suggestion in account: <head><script type='text/javascript'>function denySubmit() { alert('you will not going anywhere'); //but the the form will now NOT load the 'lol.php' return false; }</script></head><body><form action='lol.php' method='get' onsubmit='return denySubmit()'><input type='text' name='myText' /><input type='submi
  14. Hello,I'm new to using (MySQL) databases through Eclipse, and would like to know how it's done.Currently I have my project for a windows application. It's fully written in Java. But to distribute the app, I'm using an executable wrapper that packs up the jar and necessary files into one exe, and then I rar it along with some gfx and sfx folders into one nice archive. The idea is that I further develop this windows application using a MySQL database (which I hereby want to start using), untill I port it to an applet for websites and then switch to an existing online MySQL server. If it is possi
  15. You're right about the origin of this account, did you remember that? But you're slightly inaccurate about the irony part. We had an aggreement that I should take over all of his work and memberships, and continue on his ideas for a website. I quite did not force it, in fact, I was given permission. This was all a long time ago though, long before the post you refer to.It may seem a little confusing, I understand. But I don't really want to talk about the origin. I'm the only one now, and anything that has recently come up as one of my threads is in fact really mine. I wouldn't have posted my
×
×
  • Create New...