简体   繁体   中英

Can someone tell me what this small chunk of js code is doing?

I program in different languages, but not in javascript. I can kind of tell what the code in the rest of the program is doing, but I don't understand this part. If anybody can help me out that would be great.

    log: {
        content: "<div id='exp1_div'></div><div id='exp2_div'></div><div id='exp3_div'></div>",
        onLoad: function() {
            $('#exp1_div').html("Experiment 1: " + log["exp1"]);
            $('#exp2_div').html("Experiment 2: " + log["exp2"]);
            $('#exp3_div').html("Experiment 3: " + log["exp3"]);
        },
        keyHandler: doNothing
    }

Someone claims that I broke their program. What the program is supposed to do is finish an experiment and write the results in a log file. I fixed everything else, but I can't figure out the log file part. Ie where is the log file? What is the name of the log file? Etc.

content: "<div id='exp1_div'></div><div id='exp2_div'></div><div id='exp3_div'></div>"

It is creating 3 div's exp1_div, exp_2_div, exp3_div.

$('#exp1_div').html("Experiment 1: " + log["exp1"]);

It is then selecting the individual div and filling its inner HTML with a corresponding entry from an array (not listed in this snippet). The array has elements "exp1", "exp2", and "exp3".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM