Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Can't get javascript quiz to work properly?

    Hi - would appreciate some help with this school project. I can't get this simple quiz to work correctly, it should give a pop-up with a pass/fail message on submit. Can anyone see the error?

    Instead of posting the whole code - the live version is here with all the code in the doc head...

    http://bit.ly/hR8JYk

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,918
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts
    Have you tried using your error console?

    line 13 document.myform.q1 is null or not an object.


    It is your responsibility to die() if necessary….. - PHP Manual

  • #3
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi- have corrected the Array entry to read quiz.q1, quiz.q2 etc....

    Still not working although am nearly there... can sense it!!!

  • #4
    Senior Coder Logic Ali's Avatar
    Join Date
    Sep 2010
    Location
    London
    Posts
    1,028
    Thanks
    0
    Thanked 207 Times in 202 Posts
    Quote Originally Posted by clement View Post
    Still not working although am nearly there... can sense it!!!
    Yes - all you have to do is look at the console again:
    Code:
    Error: syntax error
    Source File: http://www.liamcarey.com/pages/quiz.html
    Line: 1, Column: 8
    Source Code:
    onclick=return checkAnswers()

  • #5
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Logic Ali View Post
    Yes - all you have to do is look at the console again:
    Code:
    Error: syntax error
    Source File: http://www.liamcarey.com/pages/quiz.html
    Line: 1, Column: 8
    Source Code:
    onclick=return checkAnswers()

    What console do you mean? Am using Dreamweaver and it doesn't show any errors? What is the correct code if this one is wrong?

  • #6
    Senior Coder Logic Ali's Avatar
    Join Date
    Sep 2010
    Location
    London
    Posts
    1,028
    Thanks
    0
    Thanked 207 Times in 202 Posts
    Quote Originally Posted by clement View Post
    What console do you mean? Am using Dreamweaver and it doesn't show any errors? What is the correct code if this one is wrong?
    Firefox -> Tools Menu / Error Console

    It seems you've fixed that problem but now the console is indicating another problem:

    Error: allQuestions is undefined
    Source File: http://www.liamcarey.com/pages/quiz.html
    Line: 41


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •