Quiz Results - Scored Answers Are Displayed In The New Window - There Are No Spaces
Apr 18, 2011
My client wants a simple quiz with the correct answers displayed if they get them wrong. I used code from somewhere on this site, but this is the first time I have ever wrote javascript. My problem is: When the scored answers are displayed in the new window, there are no spaces. How do I format the script to display text with breaks between each answer?
I'm working on a simple website in which I'm required to use two types of forms input on a webpage. I have decided to make a simple quiz which will be designed.Is this possible in a simple way? Sounds quite straight-forward.Is it possible to design a radio button which, depending on the choice, the related-text will appear underneath on the same page? So if they select 'A' then paragraph 'A' will show, if they select 'C' then paragraph 'C' will appear (with the rest hiding)..
I run a math site and I just recently built a little program to generate math problems. When the user submits the correct answer the program changes the problem and all the steps/hints. Everything works fine except that during the change over there are all these weird blocks (same color as my background) (*FireFox Only). It only lasts for a couple of seconds, but it would be nicer if it smoothly replaced the problem. Here is the test site:
[URL]
writeProblem() is called when the user gets the right answer and asks for another problem:
var writeProblem = function(){ //these are neccessary after the first call to writeProblem. $(".steps").hide();
i have the a drop down list that depending on the user selection display the list of results for example if (select color) display (red, blue, pink)if select car display(ford,bentley,ferrari) and so on but now i am trying to put the result in a table each element to their own or column.
I cant find an example for this, but I'm sure people will know what I mean. Imagine a form on a page, the user hits submit, but a new page does not load, instead a "busy" graphic displays, then disappears and then the results of the input are displayed.
Does anybody have a link to a tutorial or an example of this kind of feature? Or even a few google keywords to search for would be cool also.
I'm currently working on a javascript form validator and have run into a problem. The validator is used to make sure that the customer has entered a number in the quantity input box of the item they wish to purchase.
Code:
function validateRE(fieldToCheck, strRegExp, msg, min, max) { if (!min) { min = 0 } if (!max) { max = 100 }
for (i=0;i<15;i++) { if (fieldToCheck[i].value) { var re_pattern = strRegExp; if (!re_pattern.test(fieldToCheck[i].value) || fieldToCheck[i].value.length < min || fieldToCheck[i].value.length > max) { alert(msg); fieldToCheck[i].focus(); fieldToCheck[i].select(); return false; } } } return true; } Used with:
validateRE(this.quantity, /^[1-9]{1}$|^[0-9]{2,3}$/, 'Please enter a Quantity.', 1, 3)
);"> The part in question is the red highlighted section. The number of items that is under a specific product is generated dynamically and can range from 2-20. How can I get javascript to count the total number of items and run "for i=0;i<total number" instead so it is different for each product page?
I have a button known as "Prepare Questions". Now when I click on this button, this button does two things, using the validaton() function it validates the form so that if there is an error in the form (empty textbox and radio button not selected) then it displays the suitable error messages on the page. But also the button uses the "openSessionPopup" function so that it opens up a pop up window which states the word "Session".
The problem is that when I click on the button it does both functions, so it displays validation errors if there is some and also opens up the pop up window.
What I want to do is that the pop up window should only be displayed after there are no validation errors. But I can't seem to get this to work, does anyone else know how to do this. I tried modifying it but now the validation works but the pop up window does not appear at all
I have found out that doing a window.resizeTo(w,h) does not resize the client area tot his size, but the entire window (including tool bars etc).
So, with an address bar, a tool bar and a status bar etc showing, the window.document.body.offsetHeight value will be ~200 points smaller than the required size.
We have a simple set of data in a table, but it can resize based on a font size. On change of font from a combo we call a resize function.
How can I ensure that the body.offsetHeight and widths are enough to show all of my table, without hard coding for toolbars etc (Because they may not be there on some browsers.)
Is there a way like in java to *pack* the client area to best fit?
I found an article [URL] that allows a user to search Google directions from a web page. It works very well, however is it possible to have the resulting page open in a popup window?
I've copied and customized a script to display a css popup in my little website. The script should display a popup in the middle of the browser window, graying out the background, Everything seems to work fine except that at the end of the script, the page is displayed from the top. This means that if you click on the popup link from a position down in the page, you'll miss it because you will be taken to the top of the page, where you can't see it.
This is the HTML and CSS code:
HTML Code:
And the js:
Code:
I've been debugging with alert boxes and everything seems to be fine until the script ends execution. Then the user is brought again at the top of the page...
In my final site the only thing I would like to show in the popup is a Flash movie.
Do you know any workaround? I would even implement a completely different solution if I knew which...
By the way: At this stage I am using Chrome but I would like my solution to work in any browser, that will the next issue.
I use php includes to display a small form on a web page.The form has only about 2 fields,and when the user hits submit I want the form to be submitted but at the same time I dont want the page to be redirected.Instead I want a small window to pop up saying thank you or whatever.To see a demonstration of what I want to do,please go to download.com ,scroll down to the bottom of the page and you'll see a poll.When you make a vote a new window pops up showing the results of the vote but you arent moved from download.com's homepage to any other page in the parent window.How can I acheive that?I'm using this code right now:
<script language="JavaScript"> function showpoll() { window.open('manage.php','manage','width=260,height=360,status=no,scrollbars=yes,resizable=no,toolbar=no'); document.forms["form1"].submit(); } </script>
<form method="post" action="manage.php" onSubmit= "showpoll();" name="form1"> When I hit the submit button on the form a new window does pop up containing manage.php but it doesnt submit the form since manage.php doesnt give the message that its supposed to give when the form is submitted.It instead asks me to input all the fields.While the parent window is redirected to manage.php and it shows the message that its supposed to show when the form has been submitted.I hope I made myself clear.
I've got a page that lists a bunch of info in a large table. In each row is a link, and when that link is clicked on, an ajax call fires that returns detailed info on the item in that row. I usually display the html just to the right of the table, but the table has gotten too large. I need to display the info in a pop up now. The only thing is, how do I get the results of my ajax call into a pop up window? I've been having an awful time getting this to work.
I'm using JQuery to make the ajax call, what can I put in my success of complete event to create the pop up using the data the ajax call returns?
My code goes through the answer function (below) and it determines if you answered green. If you answered green a popup says correct other wise incorrect. How can I modify my code so that I can add multiple answers for different questions.Example q1.html what color is the grass? q2.htm what color is the sky? now in my javascript every question is going to go through the answer function and think the answer is green. that would be correct for q1.html but what if i am on q20.html and it goes through the answer function. It will think the answer is green. So how can i change the code so q1.html knows that the answer is green. q2.html knows the answer is blue?
I have a question about child parent window in firefox. I have 2 pages Parent.php and child.php... user enter details in Parents.php to show the results from DB. results are displayed in child.php. I tried to put a link/button on child.php "close the window". it closes BUT it takes me to parent page. IS there anyway I can close both windows simeltaneously???
I created a quiz which detects if your answer is correct or incorrect in javascript, however, if have a question like what color is the sky and the user types in "light blue" it code will see that as wrong and the right answer should just be blue.. Is their anyway for this code to be changed so that the user gets the the correct answer if the word blue was entered, even if their are other words as well? For example all these answers should be accepted as the right anwer.
What color is the sky? blue light blue dark blue a blue color
I need to create a form that has three questions, but the answers have to match my answers...what is the best way to do this (without DB). I was thinking create an array with the 3 answers then match the fields with the answers in my array.
Ive made the quiz works fine but instead of a box which displays the percentage I would like to have a pop up box when they click the submit button, also inside the pop up box it displays i.e. you got 4 out of 10 for example.
<HEAD> <script language="JavaScript"> var numQues = 10;
I wrote quiz using HTML and JavaScrip. Score is accumulated in a variable called myScore. Now I want to email the result of myScore to an email address. How do I go about doing this? I don't want to use the mailto: command since that require that user actually press the send command to send the email. I want this done automatically after user finishes the quiz.
I am making a simple multiple choice quiz and if user gets all correct i need it to automatically go to a new page rather than having a manual button for that so they cant move on until all questons are answered correctly.
The page will display brief instructions followed by a table containing the quiz.The first is with the Score() function which reads as follows:
function Score(){ for(i=1;i<=10;i++) if(ans[i]== yourAns[i])
[code]....
Now unless I'm mistaken (which I am since the score isn't being tabulated correctly) this function essentially uses a for to cycle through both arrays, comparing the user's input against the array containing the right answers. If the contents within index i are the same on both arrays the score increases by one point. Once it cycles through the arrays, it passes score over to prequiz.score.value which will later pass this number to the text box that will display the grade to the user.
Thinking it was the setAnsArray(question, answer) function I added a document.writeline to it. However it showed that the values were being passed correctly to the answer array. Added a document.writeline to the Score() function. Unlike the point above, score always displays as 00000 regardless of how many right answers I provide.
The second issue I'm having is that the reset button is not working correctly. If I hit reset and answer the first question, the score will come back as double the score displayed before.
<?xml version="1.0" encoding= "utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
I'm trying to make a Quiz that generates random pictures each time the page is launched , with multiple options for the user to choose the right answer satsifying the picture and its meaning .
I've made the pseducode and i understand the algorithm ..but i don't know how to write the statements .
My algorithm is :
1-Random picture is shown each time the page is launched.
2- 6 Buttons are placed .
3-user choses the right matching answer.
4- window is popped up saying "correct"when its correct if not , an alert saying ;'Your answer is incorrect. Please try again"
So this is the code i've made , i know there's errors but just to show the Idea.
I am trying to add a dropdown list with the point values 1, 2, 3 ,4.If I use the number 1 from the dropdown for the first question, I need it to not allow the user to use that value again for questions 2, 3, and 4.