简体   繁体   English

有人可以告诉我这小段JS代码在做什么吗?

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

I program in different languages, but not in javascript. 我用不同的语言编程,但不使用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. 它正在创建3 div的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). 然后,它选择单个div,并用数组中相应的条目填充其内部HTML(此代码段中未列出)。 The array has elements "exp1", "exp2", and "exp3". 该数组具有元素“ exp1”,“ exp2”和“ exp3”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 有人能告诉我我做错了什么 - Can someone tell me what am i doing wrong Discord.js - 类型错误:无法读取未定义的属性“声音”。 有人可以告诉我我做错了什么吗? - Discord.js - TypeError: Cannot read property 'voice' of undefined. Can someone tell me what I'm doing wrong? 有人可以告诉我这个JS警报有什么问题吗 - can someone tell me what is wrong with this JS alarm 你能告诉我这段代码在做什么吗? - Can you please tell me what is this peice of code doing? 有人可以告诉我这段代码如何运作吗? - Can someone tell me how this code works? 我正在为一堂课制作井字游戏。 有人可以看一下我的代码并告诉我我做错了什么吗? - i am building a tic tac toe game for a class. can someone look at my code and tell me what i am doing wrong? 有人能告诉我,我对HTML / JS代码的解释是否正确? - Can someone tell me if I am right in my explanation of HTML/JS code? 我正在学习编码,有人可以告诉我哪里错了吗? - I am learning to code, can someone please tell me what is wrong? 有人可以告诉我我的代码有什么问题吗? 返回正确的世纪 - Can someone tell me what's wrong with my code? Return correct century JavaScript:有人可以告诉我我的代码出了什么问题吗? - JavaScript: Can someone tell me what's going wrong with my code?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM