Talk:JavaScript Challenges

From Wikiversity

Jump to: navigation, search
  // you only need the following line if you don't already
  // have a variable for your quantity field.
  var email = document.getElementById("email");

  // First, create a variable to remember the position of the "@" symbol
  var atPos = email.value.indexOf("@");

  if (atPos == ??) // you need to replace the question marks with 
  {
    // Then there wasn't any @ symbol within the email address!
    // Let the user know that they need to correct the error!
    // Add your code below: 


    // Lastly, return false so that the form won't be submitted.
    return false;
  }

you need to replace the question marks with... With what? Stuck here.


We should also invest in some syntax highlighting. --64.129.128.2 21:01, 11 January 2007 (UTC)

[edit] onsubmit or onSubmit

Hi 72.49.106.105 (whover that IP maps to!)

Thanks for getting in and editing the Javascript challenges! Just a note, onsubmit should actually be all lower case for XHTML... but you're right, in HTML 4 it was onSubmit (I think?). I've changed it back for the moment... hope that's ok!

Sorry, yeah that IP is me, I'm totally new to JScipt but have been studying web design for 5 years. I'm looking at the javascript cheat sheet from ilovejackdaniels.com ans it has onSubmit. I know that JS is pretty sketchy when it somes to case sensitivity. When i ran it with onSubmit on my home server it worked... It really makes no difference to me I'm trying to learn it and am not a prof by any means. -- Koolaidman Talk Contribs 02:45, 11 February 2007 (UTC)
Great! I hope you find the resources here useful... and please continue to update and improve them as you go :) Yeah, I noticed the Jack Daniels cheat sheet uses onSubmit form for events. The main thing is (1) that you're consistent, then your JS code will work either way. But to get your XHTML files to validate you'll need to use lower case. Hope that helps Michaelnelson 00:48, 12 February 2007 (UTC)
Thanks, I'll have to take a look at the standards for event handlers, I haven't really paid much attention to them prior to now. -- Koolaidman Talk Contribs 01:51, 12 February 2007 (UTC)

[edit] Challenge 5

"For example, isNaN(1.5) will return true, whereas isNaN("hi there") will return false." I'm learning so I don't really want to edit this myself, but I'm pretty sure this can't be right. Atleast not according to the W3 demo that is referred to...

Thanks annon!! Fixed up now. Michaelnelson 03:06, 30 July 2007 (UTC)

[edit] W3Schools.com Down?

Is it just me or is w3schools down at the moment? I got frustrated with not being able to reference w3s while working on example #5 a few days ago and the site hasn't been up since. TMyhres 06:32, 21 September 2007 (UTC)