Page 2 of 2 FirstFirst 12
Results 16 to 25 of 25

Thread: JavaScript Quiz works in IE, FF, Chrome but not Safari

  1. #16
    Join Date
    Apr 2012
    Porstmouth, NH
    lol, in my book plumbers are experts and make a nice living!

    You have been generous with your time and I appreciate it. This function is very close to working and I believe the "parse" is causing an issue because it is an actual JavaScript method so perhaps the JS engine is Safari is upset that it is being declared as a variable in this function.

    Plus, the actual debugging error in Safari says "Can't find variable: parse"

    So I tried changing the name (to "parced" and "place" but it still says it can't find that variable.

    I then declared it as a variable, var parsed; (undefined), but same result.

  2. #17
    Join Date
    May 2006
    Somewhere behind your screen
    try this one (no coockie engaged):
    Last edited by Padonak; 05-01-2012 at 12:44 PM.
    signature under construction

  3. #18
    Join Date
    Apr 2012
    Porstmouth, NH

    Thumbs up

    You are a master Plumber! That worked wonderfully on Safari as well as on the iPad! Fantastic!

    You made my week! As geeky as this may sound, I am going to spend the rest of the afternoon studying what you have done and hopefully start my JavaScript apprenticeship in the shadow of such a great plumber (yes, I am actually this corny in real life!).

    And no cookie is used? That's a lot for me to learn!

    Thank you Padonak!

    . . . and as for your English, it's pretty darn good, better than many of my co-workers (I am french canadian but went to English schools).

    I'd love to buy you a beer! subquark at gmail

  4. #19
    Join Date
    Apr 2012
    Porstmouth, NH
    lol on the "burn in hell!" =D

  5. #20
    Join Date
    May 2006
    Somewhere behind your screen
    lol )) i can explain every line to you there's no need to waste time on it )) so wait for the explanations <wink>

    p.s. i do not drink at all ))))))))))
    signature under construction

  6. #21
    Join Date
    Apr 2012
    Porstmouth, NH
    That would be great! And what a neat JavaScript trick you did for the images! =)

    I gave up drinking two years ago, the only thing I miss is the ritual of having a vodka martini on a Friday evening but it's all good! And I sleep much better too!

    Thanks again, and if you do write up an explanation, I'd love it.

    If you have a blog, I think you'd get traffic over this one - we do eLearning and have left Flash behind. We needed some form of low level assessment and can't count on having any server-side scripting available, so this simple quiz was okay for us. Separating the answers into a separate JS file was good enough because if our users figured that out, they should do well on the quizzes! =)

    I searched for a good week on something like this - JS, XML, AJAX, JQuery, anything at all and most solutions were poor. Plus it has to be HTML5 for us and work on almost anything.

    Your code allows for that and I think many other corporate eLearning departments are in the same boat.

    Not able to use SQL or a scripting language really limits this for us (on my own time I do a bit in MySQL, Apache, PHP for http://simonastick.com ).

    Thanks again Padonak, you are truly appreciated.

  7. #22
    Join Date
    May 2006
    Somewhere behind your screen
    check mail ))

    by the way, i think it is possible to build the first array (correct answers) so that it will not be easily seen in the code to confuse cheaters
    Last edited by Padonak; 05-01-2012 at 03:56 PM.
    signature under construction

  8. #23
    Join Date
    Apr 2012
    Porstmouth, NH
    A secret way to build the array? Now you have aroused my curiosity! This could be handy if it doesn't confuse me as how to assign those right answers!

    wow, I just searched JavaScript obfuscation and holy cow! Lots of tools out there! I will exoplore some and see what I find, thanks!
    Last edited by subQuark; 05-03-2012 at 09:27 AM. Reason: added info

  9. #24
    Join Date
    Apr 2012
    Porstmouth, NH
    I think I may just do the following which will be a little confusing but not hard.

    Our target audience is pretty good about not cheating and this quizzing does not impact their job and is offered as a self-guidance tool.

    Making two arrays of odd and even answers and concatenating them will work for us (latin terms for odd and even used):

    var impar = new Array('a','c','b','b','b');
    var etiam = new Array('a','a','b','d','a');
    var answers = impar.concat(etiam);

  10. #25
    Join Date
    Feb 2014

    Red face How can I remove the alert message with counting the w's and r's

    Hi Padonak,

    your help for subQuark helped me also a lot with my quiz.
    Everything works fine,a lso on Safari etc. but I can't get out your alerts. If I remove it the script doesn't work.

    Here is my code:
    <script type="text/javascript">
    // src="scripts/quizconfig.js"
    // JavaScript Document
    // answers to each
    var correct=['c','a','c','b','a','c','c','b','b','b'];
    var answers=[];
    // quiz function
    function gradeit(){
    for(var i=0;i<correct.length;i++){
    var radios=eval("document.myquiz.question"+(i+1)),current='';
    for(var k=0;k<radios.length;k++){
    var val=radios[k].value;
    var r=0,w=0,ratio=0;
    for(var z=0;z<answers.length;z++){
    if(ratio<1){alert('Sie haben noch keine Frage richtig beantwortet! Bitte machen Sie das Quiz noch einmal!');}
    var str='?a='+answers+'&r='+ratio; 
    <!--Comments on configuring quiz script-->
    <!--Change the questions below any way you want, but make note of the following:-->
    <!--1) Perserve the <FORM> tags -->
    <!--2a) Inside each radio button, use the VALUE attribute to denote each question's choices: "a", "b", "c" etc.-->
    <!--2b) Inside each radio button, use the NAME attribute to denote which question the button belongs to ("question1", "question2" etc-->
    <!--3) Script supports unlmited # of questions. Be sure to edit .js file to enter corresponding solutions-->
    <form method="POST" name="myquiz">
      <h2>Datenschutz Online Test</h2><br>
      <div class="qheader">Frage 1: Wer oder was schütz der Datenschutz?</div>
    <input type="radio" value="a" name="question1">&nbsp;&nbsp;Elektronisch gespeicherte Daten<br>
    <input type="radio" value="b" name="question1">&nbsp;&nbsp;Stellen vor dem Zugriff von Hackern<br>
    <input type="radio" value="c" name="question1">&nbsp;&nbsp;Persönlichkeitsrechte<br>
    <div class="qheader">
    Frage 2: Über die Verwendung der eigenen Daten bestimmt ...</div>
    <input type="radio" value="a" name="question2">&nbsp;&nbsp;der oder die Betroffene.<br>
    <input type="radio" value="b" name="question2">&nbsp;&nbsp;die verantwortliche Leitung der Stelle (Amt, Diakonische Einrichtung, Firma), die die Daten gespeichert hat. <br>
    <input type="radio" value="c" name="question2">&nbsp;&nbsp;je nach Sachlage der oder die Betroffene bzw. die verantwortliche Stelle. <br>
    <div class="qheader">
    Frage 3: Anschriften ... </div>
    <input type="radio" value="a" name="question3">&nbsp;&nbsp;sind freie Daten. <br>
    <input type="radio" value="b" name="question3">&nbsp;&nbsp;sind Daten, über deren Verwendung datenverarbeitende Stellen nach sorgfältiger Prüfung selbst bestimmen dürfen.<br>
    <input type="radio" value="c" name="question3">&nbsp;&nbsp;unterliegen wie alle anderen Daten ebenso den Datenschutzbestimmungen. <br>
    <div class="qheader">
    Frage 4: Datensicherheit ...</div>
    <input type="radio" value="a" name="question4">&nbsp;&nbsp;wird ausschließlich durch von der Stelle zu treffende technische Maßnahmen hergestellt. <br>
    <input type="radio" value="b" name="question4">&nbsp;&nbsp;muss auch von der Mitarbeiterschaft umgesetzt werden. <br>
    <input type="radio" value="c" name="question4">&nbsp;&nbsp;ist Sache der auf der Stelle eingesetzten Programmen. <br>
    <div class="qheader">
    Frage 5: Wenn vorhandene personenbezogene Daten für andere Zwecke verwendet werden sollen, ... </div>
    <input type="radio" value="a" name="question5">&nbsp;&nbsp;muss geprüft werden, ob es dazu eine Rechtsgrundlage gibt. <br>
    <input type="radio" value="b" name="question5">&nbsp;&nbsp;muss immer eine Einwilligung eingeholt werden. <br>
    <input type="radio" value="c" name="question5">&nbsp;&nbsp;ist dies zulässig, wenn sie rechtmäßig erhoben und gespeichert wurden. <br>
    <div class="qheader">
    Frage 6: Maßnahmen zum Datenschutz müssen getroffen werden, ... </div>
    <input type="radio" value="a" name="question6">&nbsp;&nbsp;wenn ein Risiko für die Betroffenen absehbar ist. <br>
    <input type="radio" value="b" name="question6">&nbsp;&nbsp;wenn Betroffene ein Risiko geltend gemacht haben, von dem sie betroffen sind. <br>
    <input type="radio" value="c" name="question6">&nbsp;&nbsp;egal ob Risiken erkennbar sind oder nicht. <br>
    <div class="qheader">
    Frage 7: Wofür besteht Auskunftsrecht? </div>
    <input type="radio" value="a" name="question7">&nbsp;&nbsp;Es gilt nur für Daten in Akten. <br>
    <input type="radio" value="b" name="question7">&nbsp;&nbsp;Es gilt nur für elektronisch gespeicherte Daten. <br>
    <input type="radio" value="c" name="question7">&nbsp;&nbsp;Es gilt für beides.<br>
    <div class="qheader">
    Frage 8: Nicht geschäftsfähige Personen (Kinder, geistig Behinderte) ... </div>
    <input type="radio" value="a" name="question8">&nbsp;&nbsp;haben kein Selbstbestimmungsrecht hinsichtlich der Verwendung ihrer Daten. <br>
    <input type="radio" value="b" name="question8">&nbsp;&nbsp;haben dieses Recht in soweit, wie sie Einsicht in die Folgen haben. <br>
    <input type="radio" value="c" name="question8">&nbsp;&nbsp;haben zwar Anspruch auf Datenschutz, es entscheidet aber der Betreuer, die Betreuerin.
    <div class="qheader">
    Frage 9: Ist eine Person durch eine Datenverarbeitung geschädigt worden und erhebt Schadensersatzforderungen ... </div>
    <input type="radio" value="a" name="question9">&nbsp;&nbsp;muss sie einigermaßen plausibel darlegen, dass die verarbeitende Stelle einen Fehler gemacht hat. <br>
    <input type="radio" value="b" name="question9">&nbsp;&nbsp;muss die datenverarbeitende Stelle nachweisen, dass sie keinen Fehler gemacht hat. <br>
    <input type="radio" value="c" name="question9">&nbsp;&nbsp;stellt ein Gericht fest, wer inwieweit verantwortlich ist. Die Gerichtskosten trägt dabei die verarbeitende Stelle. </div>
    <div class="qheader">
    Frage 10: Wenn in Vertretungsfällen Daten zugänglich gemacht werden müssen ... </div>
    <input type="radio" value="a" name="question10">&nbsp;&nbsp;können Passworte weitergegeben werden, wenn die Empfänger verpflichtet werden, diese nicht mißbräuchlich zu verwenden. <br>
    <input type="radio" value="b" name="question10">&nbsp;&nbsp;müssen die Berechtigungen des Berechtigungssystems entsprechend geändert werden. <br>
    <input type="radio" value="c" name="question10">&nbsp;&nbsp;können sowohl das Berechtigungssystem geändert als auch Passworte weitergegeben werden. <br>
    <br> <br>
    <input type="button" value="Auswertung" name="B1" onClick="gradeit()"> 
    <input type="button" value="Auswahl zurücksetzen" name="B2" onClick="document.myquiz.reset()">
    I want to remove the alert: 'Sie haben noch keine Frage richtig beantwortet! Bitte machen Sie das Quiz noch einmal!'
    and this counting of the w's and r's which come when you click on "Auswertung" (engl: results)
    I don't want to have any alert messages.

    May you can help me.
    thanks a lot

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



X vBulletin 4.2.2 Debug Information

  • Page Generation 0.11174 seconds
  • Memory Usage 3,006KB
  • Queries Executed 15 (?)
More Information
Template Usage (36):
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (1)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (10)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (74):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates