/    Sign up×
Community /Pin to ProfileBookmark

Help Kids With Math

I’m trying to help kids with math at my daughter’s school. I have some code that replaces flash cards. The kids do the 3-minute test, then they have to go to a form and fill it out.

[url]http://oberman.info/test/[/url]

Ideally, I’d like a single URL where the kids didn’t have to reenter operation, high number, low number, correct, and incorrect.

I have a system set up that captures the email data, parses it, and accumulates the data in SQL Server. I’m a hack and have tried to figure out how to combine theses two files so there isn’t double input and the results sent automatically.

The kids will get trophies at the end of the school year for participating.

If anyone has the time to combine these, it would be great. Thanks!

to post a comment
JavaScript

67 Comments(s)

Copy linkTweet thisAlerts:
@konithomimoJan 07.2006 — I have attached the two combined.

[upl-file uuid=10efae34-075b-4234-b1a1-6c293975dc6d size=15kB]kidsmath.txt[/upl-file]
Copy linkTweet thisAlerts:
@swtransauthorJan 08.2006 — I renamed the file kidsmath.htm ... when I open it, and hit GO, there is an error ... will this automatically populate the form fields?

Thanks

In looking at the code, I see you did a lot of work on this. I'm wondering if I did something wrong renaming it a htm file. Thanks again!!!!!
Copy linkTweet thisAlerts:
@swtransauthorJan 08.2006 — http://www.oberman.info/test/RevisedMath.htm

I put the old code in one column of a spreadshhet and the new code in the other side. I was able to find a couple of rows that probably were making the math part of this not to work.

Also, the user needs to enter his/her user name and password, and then send the email after the math test is done.

I changed the order to accomodate this easier.

The math part is working, the emailer sends the form with a password and user name (manually entered before send) ... the other fields that come from the math side are not making it to the form. I tried to modify the form references to hidden type, but that didn't work either.
Copy linkTweet thisAlerts:
@konithomimoJan 08.2006 — I rewrote the code myself to make it easier to understand, and easier to modify. I have attached it to this post. The entire thing worked perfectly for me. Let me know of any modifications that you might need.

[upl-file uuid=9c27315a-504c-4b36-9ae6-ed3a09886ab0 size=8kB]mymath.txt[/upl-file]
Copy linkTweet thisAlerts:
@swtransauthorJan 08.2006 — Thanks for your efforts. I like the revised format. Here is what I'm seeing.

When check answer is clicked, the input box does not clear.

By mistake I had the low number higher than the high number. The original math source inverts the numbers and proceeds. It is now giving an error message, starts the timer, but does not give any problems to solve.

The concept is correct, allowing input of password and username with the other fields populated.

When stop is hit, it does not appear operation is captured.

Although numbers appear in the mail form, they are not sent. You can replace the 332211@ eamil address (20 lines from bottom) with your and see the results. They have a quota of 10 per hour.

I tested the divide program. In the original code, it looks like divide ignores the random generator and only gives numbers that equal a round number. It also appears the original code ignores the high/low selection boxes.

Thanks again.
Copy linkTweet thisAlerts:
@konithomimoJan 08.2006 — Here it is with all of the fixes. I am not sure if the email data will send right, since it only allowed me to get 2 emails, but it should work fine.

[upl-file uuid=f27f5efd-6329-4e89-98b5-9848d1f84aa5 size=8kB]mymath.txt[/upl-file]
Copy linkTweet thisAlerts:
@swtransauthorJan 08.2006 — I just figured out the email thing, needed name =

Username:<br>

<input type="text" name="UserName" "id="user" size=10><br>

Password:<br>

<input type="text" name="Password" id="pass" size=10><br>

Operation:<br>

<input type="text" name="HighNumber" readonly id="op" size=10><br>

High Number:<br>

<input type="text" name="LowNumber" readonly id="highnum" size=3><br>

Low Number:<br>

<input type="text" name="HighNumber" readonly id="lownum" size=3><br>

Correct:<br>

<input type="text" name="Correct" readonly id="endcorr" size=3><br>

Incorrect:<br>

<input type="text" name="Incorrect" readonly id="endincorr" size=3><br>

<input type="submit" value="Send" id="send">

I'll try waht you just sent. Thanks
Copy linkTweet thisAlerts:
@konithomimoJan 08.2006 — I already noticed that. Those fixes are in my last attachment.
Copy linkTweet thisAlerts:
@swtransauthorJan 08.2006 — Your latest is sending the fields. All except the operation. It does not come accross to the form after taking the test.

One other thing I just noticed, the low number seems to always be zero.

This seems to be very close !!!!
Copy linkTweet thisAlerts:
@swtransauthorJan 08.2006 — Actually it only defaults to zero if something other than 12 is selected. So the low number, always is 0 during the test.
Copy linkTweet thisAlerts:
@swtransauthorJan 08.2006 — It doesnt stick on zero always, testing it more if something like a 5 + 1 are high/low, after about 45 seconds the same numbers keep coming up on the exam ... most of the low numbers seem to be zero even though the low number selected is higher than that.
Copy linkTweet thisAlerts:
@konithomimoJan 10.2006 — The email worked fine for me. My email looked like:
UserName: Me

Password: Me

Operation: Multiply

HighNumber: 12

LowNumber: 0

Correct: 1

Incorrect: 0


As far as the other things, the cod stops working after 20 questions because I had some test code that I forgot to remove. To make things better you could also do a feew things differently.

You could change:

var low = Math.floor(Math.random() * (h-l-1));

to:

var low = Math.floor(Math.random() * h);

and then insert an if statement to make sure that it is above the low #:

if(low < l)

{

doMath(0);

return false;

}

I have added the changes to the attachment for this post.

EDIT- I had to reupload the attachment, so you might want to redownload it if you have already downloaded it.

[upl-file uuid=bbcad716-a130-493d-85b8-5185b27551bf size=8kB]completemath.txt[/upl-file]
Copy linkTweet thisAlerts:
@konithomimoJan 10.2006 — I figured out what the problem with the operation field was. It worked fine in Mozilla, but in other browsers it doesnt. The reason is because I copy/pated that from your old code, and in your old code you didnt have any values for the options in that select object. Mozilla will take the option's text as its value, but other browsers don't. I have attached the code with the fix included. Now the code should work how you want it to.

[upl-file uuid=c23be449-ae4d-4c25-95a0-92341c58b3ac size=8kB]mathdone.txt[/upl-file]
Copy linkTweet thisAlerts:
@swtransauthorJan 10.2006 — wow ... tested very good !!! I changed the visual format of the page.

http://www.oberman.info/test/RevisedMathDone.htm

While you were combining the math and webform, I started to think this would be better if it had a highest number 20. I was able to figure that modification out.

Also thought it would be nice to have the choice of minutes (5 minutes, 4, 3, 2, 1). I was not able to figure out how to get the dropdown to work.

That value also needs to be passed to the webform. I put a place for it in the webform area, called it ttttt. I reset the time to 41 seconds just for quicker testing.

There are two other things that would be nice.

The person has to click check answer. If would be nice if they could also hit "enter" if it wasn't too much coding.

Thanks again. Looks like we will start a trophy program for the kids next week!!!
Copy linkTweet thisAlerts:
@konithomimoJan 10.2006 — I have attached the changes that you wanted to this post.

[upl-file uuid=5cbe3ad7-99a2-410a-b303-d991a2564b6f size=10kB]comp.txt[/upl-file]
Copy linkTweet thisAlerts:
@swtransauthorJan 10.2006 — Thanks again. I'm off to the school to discuss how we kick this off.
Copy linkTweet thisAlerts:
@swtransauthorJan 10.2006 — found something ... every time you answer a question, the timer resets itself
Copy linkTweet thisAlerts:
@konithomimoJan 10.2006 — Fixed

EDIT - Sorry...i uploaded the wrong file. here it is now:

[upl-file uuid=6b956374-ccf8-4109-8b66-8cec886172c7 size=10kB]mathcount.txt[/upl-file]
Copy linkTweet thisAlerts:
@konithomimoJan 10.2006 — I found one other thing. The line:

var h = parseInt(hi.options[hi.selectedIndex].value);

should be:

var h = parseInt(hi.options[hi.selectedIndex].value)+1;

Other wise the upper number wont be used.
Copy linkTweet thisAlerts:
@swtransauthorJan 11.2006 — I was in and out most of the day. From what I've seen of this, it is working pretty good. I'm going to test it tonight. I'll make the change from above.
Copy linkTweet thisAlerts:
@swtransauthorJan 11.2006 — Finally sitting down with this. I made the +1 modification and noticed the highnum is also increased by one, so I added a -1 after that.

You code is so much more understandable.
Copy linkTweet thisAlerts:
@swtransauthorJan 12.2006 — I didn't find this, one of the kids found it in the computer lab. Those pesty children, lol. If the low number selected is higher than the high number, the program freezes up. The browser has to be shut down to clear it.
Copy linkTweet thisAlerts:
@swtransauthorJan 12.2006 — This is from the teacher that had kids testing it:

Some possible enhancements:


When clicking the Start button the cursor should focus on the answer box

so the kids don't need to click it with the mouse before they can enter an

answer.


The last settings should be retained, i.e. if doing multiplication,

multiplication is the default instead of addition, the high number is

retained, etc. so the kids don't need to re-enter the settings every time.


The timer doesn't time when displaying an incorrect answer's solution.

Some of the kids were leaving it there and not working because they didn't

lose time. It may be possible to set some kind of grace time for them to

see the popup window, but then have the timer kick in and continue

counting down.


Display a % score. Most of them can relate to score of 80 better than 16

correct out of 20 attempted.
Copy linkTweet thisAlerts:
@swtransauthorJan 12.2006 — My thoughts on the issues brought up by teacher/kids.

  • 1. Selecting a low number higher than high is a valid concern since it freezes up the browser.


  • 2. Automatically focus on answer box makes sense.


  • 3. Last setting retained ... probably good idea, probably would not work the way this redirects after an email is sent ... it is the email program that redirects


  • 4. The timer when an incorrect answer, not sure I agree here either. If the kid wants to sit there and not have the thing ticking, then they are not going to accrue the minutes.


  • 5. Displaying a percentage is fine, but in my opinion the quantity of correct answers is what would be best for the kids. If one kid does 90 answers correct, 10 wrong ... the other does 50 correct of 50, both in tha same time, I like the 90% person.
  • Copy linkTweet thisAlerts:
    @konithomimoJan 13.2006 — 
  • 1. Fixed.

  • 2. Fixed.

  • 3. Cannot be done without server-side script.

  • 4. Cannot be done since an alert is thrown. An alert will cause a pause no matter what. To get around this you would have to display the message on the page instead of in an alert.

  • 5. Displayed correct,incorrect, and percentage.


  • If you want to, you can create arrays to assign difficulty to each attempt a child makes. That way you can see who did better. For example, if one child got 5 out of 5 (100%) for adding in 5 minutes for a high# of 1 and a low# of 0 then the array check would show it as being low difficulty. Whereas if a child did 40 out of 80 correct while multiplying with a high# of 20 and a low# of 3, then the array check would give a difficulty level of high. It would also give a difficulty level of low if a child got 40 out of 80 iwhile multiplying with a high# of 20 and a low# of 19, since there would only be 3 possible questions that they would be asked.

    That would take a little more coding, but it wouldn't be too hard to do.

    [upl-file uuid=cf99be51-70ab-4e58-b700-fd5d9d00a8b8 size=10kB]most.txt[/upl-file]
    Copy linkTweet thisAlerts:
    @swtransauthorJan 13.2006 — Is this the same code as post #19? It looks like the early version?
    Copy linkTweet thisAlerts:
    @swtransauthorJan 13.2006 — The array thing is a good idea, but probably not needed. I'm capturing the results, and am going to give the teachers a weekly spreadshhet with detailed and summary records.
    Copy linkTweet thisAlerts:
    @konithomimoJan 13.2006 — I took my code from post #7 and edited it to be the layout that you wanted. When you changed the format you must have changed something, which caused it to not work properly.
    Copy linkTweet thisAlerts:
    @swtransauthorJan 13.2006 — You have made a lot of changes since post #7. #19 was the most recent set of fixes, but did not include the +1 from #20 and the -1 from #22.

    I'm trying to put #19 and #26 side-by-side, will post it in a second.
    Copy linkTweet thisAlerts:
    @swtransauthorJan 13.2006 — Here is the best I can do. #19 had a lot of fixes you did to it since #7.

    http://www.oberman.info/test/

    19vrs26.xls

    #19 is working fine, the only thing that wasn't working was when low was higher than high.
    Copy linkTweet thisAlerts:
    @konithomimoJan 13.2006 — True, but something that you did when you changed the layout affected the way that the numbers were inverted. I updated the one from post #7. I added the focus to the response input, I allowed for the enter button to work, I added in the time select, I updated the email form and amde it so that it will email properly. After I did all of that I just updated the layout to how you wanted it. It should work fine. You can change the layout if you want, but the code will work as it should.
    Copy linkTweet thisAlerts:
    @swtransauthorJan 13.2006 — Just did an addition using 20 as the high number, 15 as the low number in version #26. Was getting high and low numbers below both of these.

    Actually I can live with that revised format.
    Copy linkTweet thisAlerts:
    @konithomimoJan 13.2006 — Fixed

    [upl-file uuid=d4583b12-d420-46fb-8cc5-a73fcd148e5c size=10kB]most.txt[/upl-file]
    Copy linkTweet thisAlerts:
    @swtransauthorJan 13.2006 — Version #34 has errors also, there is something funky going on in it.

    Version #19, with the +1 and -1 added to it (from comments 20 and 22) works perfect. I'm calling that file Version 22.

    I was able to clearly follow your #34 code, and add the focus code, and percent score code to #19 (I attached the only code I moved over in code_changes.txt). I'm calling that file Version22_002b.

    The only thing wrong with #22 is if the low number is higher than the high number, it freezes. It looks like this version has inversion code in it.

    It is probably something obvious, but I'm a hack.

    I put both files in the directory www.oberman.info/test/
    Copy linkTweet thisAlerts:
    @swtransauthorJan 13.2006 — If it is a re-write to get the inversion code to work, why not just stop execution if low is higher than high, and tell the kid thr high number needs to be higher.
    Copy linkTweet thisAlerts:
    @konithomimoJan 13.2006 — If it is a re-write to get the inversion code to work, why not just stop execution if low is higher than high, and tell the kid thr high number needs to be higher.[/QUOTE]

    That is what my original code from one of the first posts had, but you said that you wanted it to just invert them. Either way, I got it all fixed. Here is what I changed:

  • 1. The numbers now invert.

  • 2. The numbers will stay between the high and low number.

  • 3. The score will only be to two decimal places.

  • 4. The format is how you wanted it.

  • 5. The incorrect answer message appears on the screen (instead of the alert), which makes the time keep ticking.


  • Something you might consider is putting in a pause button. It will stop the time so the student can take a break if needed. Of course the question will change once they resume though (not affecting their correct/incorrect score), to keep the student from pausing it after every question so they can solve it.

    [upl-file uuid=6f345e34-68e8-490c-bb1a-a6f72f242c39 size=10kB]finished.txt[/upl-file]
    Copy linkTweet thisAlerts:
    @swtransauthorJan 14.2006 — Looks good!! Tested it for a bit, will let the kids bang it around Monday.
    Copy linkTweet thisAlerts:
    @swtransauthorJan 14.2006 — Some kids may feel like their score was not worthy of submitting. Or maybe their parents were competing against them and it should'nt be submitted.

    I added a button to reload the page. The thought it would be a good idea to have a message box pop up to confirm it. I think this code is close, just doing something wrong with it.

    <script language="javascript">

    function UserConfirm(message,lnk)

    {

    var agree=window.confirm(message)

    if (agree)

    window.open(lnk, 'Image', 'titlebar=0 ,resizable=0, channelmode=0, directories=0, titlebar=0, top=0, left=0, width=1, height=1, fullscreen=0, scrollbars=0, menubar=0, status=0, toolbar=0').focus();void(0)

    }

    </script>

    <input type="button" value="Do Not Send" onclick="UserConfirm('Your results will not be submittednAre you sure you want to continue?','window.location.reload()')">
    Copy linkTweet thisAlerts:
    @konithomimoJan 15.2006 — Here it is with the new upgrades that you wanted.

    [upl-file uuid=820ed9c3-0a51-4223-9f48-ac369f297c42 size=12kB]finished_with_confirm_and_redo_options.txt[/upl-file]
    Copy linkTweet thisAlerts:
    @swtransauthorJan 15.2006 — Nice enhancements! I like the message box asking for the password and UserId. The math lab teacher will like the fact this is holding its setting on a replay.

    Two things:

    Divide isn't working. I'm not sure which version it started with problems, but when 15 is high number 10 is low number the question produces an answer that is usually 1. I'll work backward on the versions and try to identify which version it started doing that.

    The alert box "Are you sure you do not want to send" should be on the "Do Not Send" button not the "Send" button. Generally the kids will want to send, I was concerned the would hit "Do Not Send" by mistake, lose their work, and be upset.

    So the Yes/No alert on send can be removed (keep the password alert). The yes/no should be added to the "Do Not Send."
    Copy linkTweet thisAlerts:
    @swtransauthorJan 15.2006 — I went back and looked at version 5, 7, 19, and 37. In 5, divide was giving hard questions(7/4, 9/5, etc). In 7, the hard questions were fixed, but about a minute into the would repeat the same. In version 19, the repeat went away, but divide was giving the 11/11, 6/6, etc. Version 37 does the same thing.

    Here is what I noticed in version 37. If divide uses 20 as high, 0 as low, it seems to work correct. When I use for instance 15 and 10, is when it has problems. I'm going to test more.

    Maybe divide should just not have any options, always 20 + 0?
    Copy linkTweet thisAlerts:
    @swtransauthorJan 15.2006 — Actually changing the top number does not cause the problem. It is changing the low number. Maybe the low number should always be 0 on divide.

    I see what is going on. The original code, when using divide, didn't have an answer higher than the high number selected. So lets say 11 and 0 were selected, there could be a question 77/7.


    ******

    I added an option to use 100 as the high number and didn't change the zero. Most answers are 0, 1, or 2. A few are different. Would it be possible to use the original divide code?
    Copy linkTweet thisAlerts:
    @swtransauthorJan 16.2006 — I was thinking through divide. My daughter has flash cards that are triangle shape. One of the corners has what would be the high number, one has the low number, the other has the answer. The same card can be used to multiply or divide.

    So divide in this program would seem to be a two step approach:

    First step is to multiply using the high and low numbers. (12 x 4 = 48)

    The next step would be to grab the answer of step one and use high number. (48 / 12 =) This becomes the question, the answer is the low number. (48 / 12 = 4)
    Copy linkTweet thisAlerts:
    @swtransauthorJan 16.2006 — Wow ... I was able to figure this out!!!

    if(op.selectedIndex == 3 )

    {

    answer = (high * low) / low;

    equation = (high *
    low) + "/" + low;

    }

    **EDIT** I got rid of low number 0 to prevent any divide by zero errors

    I also figured out how to add a message to the Do Not Send.

    var myver2 = window.confirm('You clicked "Do Not Send" is that ok?');

    if(myver2)


    **************************************

    The only thing I can't figure is how to remove the var myver from the send. When I remove it, the app doesn't work. I may want to keep it in though. I'm going to see what the kids think. Is there something else I need to edit out besides those two lines?

    Actually after I changed the way divide works, I was able to get this edited out .. still may use it. Up to the kids and teacher.
    Copy linkTweet thisAlerts:
    @konithomimoJan 17.2006 — I went back and looked at version 5, 7, 19, and 37. In 5, divide was giving hard questions(7/4, 9/5, etc). In 7, the hard questions were fixed, but about a minute into the would repeat the same. In version 19, the repeat went away, but divide was giving the 11/11, 6/6, etc. Version 37 does the same thing.

    Here is what I noticed in version 37. If divide uses 20 as high, 0 as low, it seems to work correct. When I use for instance 15 and 10, is when it has problems. I'm going to test more.

    Maybe divide should just not have any options, always 20 + 0?[/QUOTE]


    you seem to have answered this question yourself . . . but incase you don't understand why my code didnt give very many options, then it is because I made it check for integer answers instead of having floating numbers(no remainders). You method works well though.
    Copy linkTweet thisAlerts:
    @swtransauthorJan 17.2006 — Your code is excellent! I understand SQL somewhat, but am lost beyond that. By studying your code, I'm starting to understand Java Script a bit. I see why you decided to re-write this. The flow is very logical now. Thanks again, will let you know how things go at school this week.
    Copy linkTweet thisAlerts:
    @swtransauthorJan 19.2006 — Everything tested well during the lab sessions the last couple days. I was playing with this, and had a couple questions.

    www.oberman.info/test/

    I added a operation called advanced (code used in example #1, file var_XML.txt). This works fine.

    I started to think, would be neat if I could use an XML file (or INI) to define the answer = and equation = area

    I had some code that lets you display XML rows in a html file (see Example 3).

    I'm not sure if I'm explaining this clearly, but is there a way to have this Advanced operations answer and equation controlled in an XML or INI file?
    Copy linkTweet thisAlerts:
    @swtransauthorJan 19.2006 — One other question. Can formulas be dropped in that do for instance, exponential?

    I tried answer = 3 ^ 3 ... gives zero instead of 27 as answer.
    Copy linkTweet thisAlerts:
    @dhjetemijeJan 19.2006 — In JavaScript, the hat means exclusive-or. To raise a number to a power, use the Math.pow() function (is it a function, or a method? What is the difference between a function and a method, anyway? Or is a method a kind of function?).

    Example: Math.pow(2,3) gives 8
    Copy linkTweet thisAlerts:
    @swtransauthorJan 19.2006 — Looks like the thing I'm trying to do in #48 can't be done. Found this in another thread.

    http://www.webdeveloper.com/forum/showthread.php?t=67637&highlight=read+text+file+function
    Copy linkTweet thisAlerts:
    @konithomimoJan 20.2006 — In JavaScript, the hat means exclusive-or. To raise a number to a power, use the Math.pow() function (is it a function, or a method? What is the difference between a function and a method, anyway? Or is a method a kind of function?).

    Example: Math.pow(2,3) gives 8[/QUOTE]

    Javascript only has functions. Other OO languages have classes, methods, and functions.
    Copy linkTweet thisAlerts:
    @swtransauthorJan 28.2006 — The kids are using this in lab. Just about ready for home use. I noticed one problem, maybe there is no solution. On a fast internet connection, the send button can only be pressed once. On dial up, the kids can push that button a bunch, which creates duplicate records. What is happening is there is a delay because that webform is going out to a server, executing the mail script.
    Copy linkTweet thisAlerts:
    @konithomimoJan 28.2006 — Here it is with the fix that you want.

    [upl-file uuid=dba5f9dd-6baa-4409-a35a-b1d1fbf3b45f size=12kB]done_with_onclick_button_fix.txt[/upl-file]
    Copy linkTweet thisAlerts:
    @swtransauthorJan 28.2006 — Thanks. Evertime you change something I look over the code so I'm learning. I've also spent a lot of time trying to learn more about JavaScript.
    Copy linkTweet thisAlerts:
    @swtransauthorFeb 03.2006 — If you want to find everything possible, have a kid test the program, lol.

    Lets say someone inputs a bad answer, then holds down the Enter key (instead of just hitting enter), all of a sudden they end up with a lot of incorrects.
    Copy linkTweet thisAlerts:
    @konithomimoFeb 03.2006 — Once they hit the enter key the answer box is cleared, so when they hold down the enter key it will submit their first answer and then give an answer of null for as long as they hold it down. The best way to fix it is to check if the answer is null. If so then return false and don't update anything. That way it won't change their score. It will just use up their time.

    I was aware that this was the case because I used that to my advantage to make for easier testing.
    Copy linkTweet thisAlerts:
    @konithomimoFeb 03.2006 — Basically you just need to add the following to checkIt():
    if(re.value == '')
    {
    return false;
    }


    I have attached it with the fix.

    Another thing that you might want to do is make it so that the children can only enter in numbers.

    EDIT: I inserted in the code to allow only numbers.

    [upl-file uuid=ea8a0b01-c151-44d9-a049-81c68c613c5b size=12kB]no empty response and only numbers.txt[/upl-file]
    Copy linkTweet thisAlerts:
    @swtransauthorFeb 05.2006 — An update on how it is being used. 2 classes are using it in lab, and finally a memo went out to parents for the kids to use this at home. Looking at the lab results, there is an unbelievable disparity in the high and low students. It must be hard to be a teacher.

    As my child uses a higher high number, I notice the error rate has gone up.

    I'm not sure if this is possible, but it would be useful to capture the results of errors to a file. I'm using this code at the moment (which stops on errors). Retained the old code because I like it also.

    if (answer != response)

    {

    incorr++;

    incorrect.value = incorr;

    quest++;

    questions.value = quest;

    alert('Your answer is incorrect. ' + document.getElementById('problem').value + ' equals ' + answer + '.');

    document.getElementById('wrong').style.display='block';

    <!-- CODE REQUIRED TO BYPASS ALERT -->

    <!-- document.getElementById('wrong').innerHTML = '<FONT FACE="arial" COLOR =" #000080"><b>That is incorrect.<br> ' + document.getElementById('problem').value + ' equals ' + answer + '.</b></font>'; -->

    doMath(0);

    return false;

    }

    }

    I'm thinking it would work like this:

  • - check to see if file C:matherrors.txt exists (if not create)

  • - write errors the file


  • Once the error file is on the C drive, I have numerous ways to display it.
    Copy linkTweet thisAlerts:
    @konithomimoFeb 05.2006 — JS cannot write to files, but MS JScript (MS's version of JavaScript, created because JS was issued as freeware, so MS cannot monopolize it) can. That being said, you will only be able to save to a text file in IE. The only other way to go is to use a server side script such as PHP and save to a txt file on your server. Either way, here is another post I made on how to save to a txt file on the harddrive using JS(MS JScript) in IE.

    http://www.webdeveloper.com/forum/s...light=save+form

    That being said, what errors are you talking about? Scripting errors, or user errors?
    Copy linkTweet thisAlerts:
    @swtransauthorFeb 05.2006 — User errors, so when the kid answers 2*3 = 7 capturing the 2*3

    http://www.webdeveloper.com/forum/showthread.php?t=88870&highlight=save+form

    Some of the characters in your link didnt get passed above. This looks like the thread.

    Could a PHP script create a file on the local C: drive (if it did not exist), then append to that file the results of "document.getElementById('problem').value"?

    (php script would be dropped into the directory on the web)
    Copy linkTweet thisAlerts:
    @swtransauthorFeb 05.2006 — After thinking about it, hitting the server after every wrong answer would probably be a nightmare. The only way something like this would make sense is if it was all done on the local machine.

    What I'm going to suggest is the kids keep a pad next to the computer, and jot down their wrong questions. Using the alert box approach, they are not losing time since it stops the timer.


    ****

    One thing I was thinking, maybe the cookie approach would work. Can information be appended to a cookie. I realize the size limit is small, but there isn't much being stored.
    Copy linkTweet thisAlerts:
    @swtransauthorFeb 08.2006 — I'm getting dangerous, lol. I was actually able to get a cookie to write the wrong questions entered by the student. I added putCookie() to the function checkIt(num).


    function putCookie()

    {

    cookie_name="dataCookie";

    var mystring;

    var myerror = document.getElementById('problem').value;

    var old_cookie = document.cookie;

    if(document.cookie != document.cookie)

    {index = document.cookie.indexOf(cookie_name);}

    else

    { index = -1;}

    if (index == -1)

    {

    mystring = escape(myerror) + old_cookie;

    document.cookie="::::"+mystring+"; expires=Monday, 04-Apr-2010 05:00:00 GMT";

    }

    }


    QUESTIONS:

  • 1. I found a link that explains how to have each wrong answer on a separate line in this cookie, but I can't seem to be able to make it work.


  • http://codepunk.hardwar.org.uk/ajs35.htm

    I have it looking like:

    ::::8 + 6::::4 + 5::::3 + 4

    Would prefer separate lines:

    8 + 6

    4 + 5

    3 + 4

  • 2. I'm using <a href="javascript:alert(unescape(document.cookie))">Questions Answered Wrong</a> to display the cookie. What is the command to delete this cookie?


  • * actully the code doesn't work exactly right ... it did at one time, but when I added document.cookie it owrked until I cleared the cookies.
  • Copy linkTweet thisAlerts:
    @swtransauthorFeb 08.2006 — The only thing I need now is some code to delete the cookie ???

    <a href="javascript?unescape(document.cookie))">Delete the Cookie</a>


    **********************

    I figured out the other stuff (well I think it is working, lol):

    function putCookie() {

    if (document.cookie && document.cookie != ""){

    var mystring;

    var old_cookie = document.cookie;

    var fresh_data = "<br>" + document.getElementById('problem').value;

    document.cookie= old_cookie + escape(fresh_data);

    }

    else{

    fresh_data = document.getElementById('problem').value;

    document.cookie = escape(fresh_data);

    }

    }

    <a href="javascript?unescape(document.cookie))">Questions Answered Wrong</a>
    Copy linkTweet thisAlerts:
    @swtransauthorFeb 09.2006 — I'm confused. The cookie works great. When the application is on my C drive. When I FTP it to the hosting company, it doesnt appear the cookie works (I answer questions wrong, it doesnt appear the document.cookie gets created.

    As for deleting the cookie, after reading the link from techpatterns, it looks like if there is no date, the cookie will expire when the browser is closed. Thats good enough.

    Maybe I'm just totally misunderstanding cookies, but it seems like that code posted in #64 should put a cookie on my machine, regardless of whether the app sits at the hosting company or on my C drive.
    Copy linkTweet thisAlerts:
    @swtransauthorFeb 09.2006 — I spent mucho hours playing with this. Decided to make as simple of a test as I could. Using the exact code, but replacing document.getElementById('problem').value with "myValue" the sample works on my C drive and when I ftp it to the host. Actually I changed the name of the function also to setCookie, but that shouldn't make a difference.

    <script type="text/javascript">

    function setCookie(){

    if (document.cookie && document.cookie != ""){

    var mystring;

    var old_cookie = document.cookie;

    var fresh_data = "<br>" + "myValue";

    document.cookie= old_cookie + escape(fresh_data);

    }

    else{

    fresh_data = "myValue";

    document.cookie = escape(fresh_data);

    }

    }

    </script>


    <input type="button" value="CreateCookie" onclick="setCookie()">

    <br><br>

    <a href="javascript?unescape(document.cookie))">View Cookie</a>

    To summarize:

  • 1. The test cookie thing works from the server www.oberman.info/cook/


  • 2. The cookie works on the math program when I have the application on my hard drive (cookie from #64, same basic cookie as this test cookie).


  • 3. The problem is, when I take the application and load it on the web, the same application that worked on my hard drive, it doesn't create the cookie.


  • Makes no sense to me.
    Copy linkTweet thisAlerts:
    @swtransauthorFeb 09.2006 — Boy now I'm really feeling dumb. I have it working. The problem was I didn't have the code that displays the error message on the internet site also, I had it local.

    Obviously I don't understand cookies, but it is working!
    ×

    Success!

    Help @swtrans spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.18,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...