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 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Feb 2012
    Location
    MT
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Anyone Use Javascript? Putting a Quiz on Website

    I am simply trying to put a quiz on my website, but I am so new to this. I have a string of questions but I'm just going to begin with my most pressing one... I am not experienced with webdesign, so I am using freewebs.com as I get comfortable with the structure and functionality of web pages. Happily, I've been able to make something quite appealing and functional, but I'm concerned that freewebs is not a site that I can really "tweak" because I'm really just choosing format and layouts from lists... Using this generator http://javascript.about.com/library/blpquiz.htm, I want to embed it into this page on my freewebs site: http://theweyrs.webs.com/hatchinggrounds.htm

    At this point I become stumped. Now if anyone isn't familiar with the Webs site biulder, it's super easy to make an account and start building a free site here: http://www.webs.com/ ..should anyone need to familiarize themselves and actually be awesome enough to decide to go to such a length for my cause. I can go into the site builder on freewebs to edit this page, and putting the script in a textbox naturally doesn't do the trick... I'm just not sure where to put it. Sorry if I am dreadfully inexperienced! I appreciate any help at all, thanks for taking the time to even read this.

    ...and sorry if any of my terms or phrases were n00bish... I'm trying very hard, more of an artist LOL.
    Last edited by Rhodalle; 02-21-2012 at 10:25 AM.

  • #2
    Senior Coder
    Join Date
    Aug 2010
    Location
    High Point, NC
    Posts
    3,332
    Thanks
    5
    Thanked 363 Times in 360 Posts
    I have to question why you'd use js to create a quiz. Users can look at your source code to see the answers, so not much security there.

    Otherwise, I'm a bit confused about your question.
    Teed

  • #3
    New Coder
    Join Date
    Feb 2012
    Location
    England
    Posts
    77
    Thanks
    0
    Thanked 12 Times in 11 Posts
    Not sure what your question is, but i am assuming you need some help with JavaScript form validation/processing.

    If you want to check a text input for something uses this:
    Code:
    <form name="form1">
    <input type="text" name="input1">
    <button onclick="check()">
    </form>
    
    
    <script type="text/javascript">
    function check(){
    var input1_value=document.forms['form1']['input1'].value;
    if(input1_value=="SomeString"){
    alert('Yes you got it right');
        }
    }
    </script>

  • #4
    Senior Coder
    Join Date
    Aug 2010
    Location
    High Point, NC
    Posts
    3,332
    Thanks
    5
    Thanked 363 Times in 360 Posts
    if(input1_value=="SomeString")
    SomeString=Answer! Yeah I got a hundred! lol

    Thats what I meant. You'd be better to use serverside like php , coldfusion or others. Unless of course it doesn't matter if ppl see the answers. Then maybe this should be in the JS forum, with some sample code you've tried.
    Teed

  • #5
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,471
    Thanks
    0
    Thanked 634 Times in 624 Posts
    A server side solution is the better way to go for a quiz but if JavaScript is the only option then you might look at the quiz scripts at http://javascript.about.com/od/quizs...ipt_Makers.htm

    They are all set up so that you can't just view the source to find out the correct answers.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #6
    New to the CF scene
    Join Date
    Feb 2012
    Location
    MT
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by teedoff View Post
    I have to question why you'd use js to create a quiz. Users can look at your source code to see the answers, so not much security there.

    Otherwise, I'm a bit confused about your question.
    Thanks for the quick responses everyone! ..And very sorry I could probably have phrased my question better, I was trying to avoid being wordy. I'll try to clarify...

    I have already created a code from a generator.. If there are better options for the kind of quiz I need, I'd still be happy to look at them. I chose this from what I could find because I need a very specific kind of quiz for my RPG fan-site for the novel series "Dragonriders of Pern." The quiz is to determine, based on the player's personality, what color of dragon (there are five) they would bond to. With many different outcomes so the results can list first and second most likely outcomes. (Doubtful anyone on my site is going to be javascript savy enough to look at the code) This is the generator used if you are curious: http://javascript.about.com/library/blpquiz.htm

    It instructs me after generating the code:

    "You now add this quiz to the head section of the page where the quiz is to appear using the following code:

    <script src="pquizhead.js" type="text/javascript">
    </script> "

    My concern is simply how to get my quiz up on my site. I use freewebs because I bypass having to touch code with the user freindly interface. I -think- that there's an advanced editor where I can access it, but I can't find it in the site builder anywhere, nor would I know how to use it, and Webs's help forum is taking weeks as usual to respond to my queries.

    So here I am, bugging anyone I can, and very sorry to be a pest, but I'd love to get this feature on my site, and have much to learn and little time to make this happen. There are people waiting in anticipation for me to put it up, and I'm the only one in our writing/art group willing to touch javascript with a 60 foot pole lol...

    In a nutshell, for now, I just want to know if I can put my quiz (with the code I generated) directly on my Webs.com free site, or are there other sites worth recommending where I can just put this quiz, and link to on the page I want the quiz to be? I just need one page to host this quiz.

    Any advice is greatly appreciated.


    My site's homepage: http://theweyrs.webs.com/
    Last edited by Rhodalle; 02-22-2012 at 12:15 AM.

  • #7
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,471
    Thanks
    0
    Thanked 634 Times in 624 Posts
    I just signed up for a free account at webs.com just so I could figure out how to solve your problem.

    1. You can upload the JavaScript files using the File Manager (the tab to the right of "Site Manager" at the top left).

    2 To actually call the script from the page you will have to insert the HTML using the "HTML" button while the cursor is in the content of the page you want to add it to. It doesn't look like there's any option to add the script into the head of the page but adding it in the body should also work. The site does have instructions for adding Google AdSense ads which also use JavaScript tags so the process will be similar to that.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.


  •  

    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
    •