View Full Version : Anyone Use Javascript? Putting a Quiz on Website

02-21-2012, 11:22 AM
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.

02-21-2012, 04:10 PM
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.

02-21-2012, 04:42 PM
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:

<form name="form1">
<input type="text" name="input1">
<button onclick="check()">

<script type="text/javascript">
function check(){
var input1_value=document.forms['form1']['input1'].value;
alert('Yes you got it right');

02-21-2012, 05:00 PM

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.

02-21-2012, 07:24 PM
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/quizscripts/Custom_Quiz_Script_Makers.htm

They are all set up so that you can't just view the source to find out the correct answers.

02-22-2012, 01:09 AM
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/

02-22-2012, 09:37 AM
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.