简体   繁体   English

有人可以解释一下这到底意味着什么吗?

[英]Can someone please explain what this means exactly?

I found this line of code in a script function and I have no idea what it means or how to alter it. 我在脚本函数中找到了这行代码,但我不知道这意味着什么或如何更改它。 Here is the code: 这是代码:

variable_name = window.document.form_name.page.value; variable_name = window.document.form_name.page.value;

It had an actual form name instead of "form_name" but what exactly is this saying, I get that its setting the variable to something but its the something that I don't understand. 它有一个实际的表单名称,而不是“ form_name”,但是这实际上是在说什么,我知道它将变量设置为某种东西,但它是我不理解的东西。 I'm rather new to script so any help is appreciated! 我是脚本新手,因此不胜感激! Thank you in advance. 先感谢您。

Somewhere in the HTML, you will see something like: 在HTML的某处,您会看到类似以下内容的内容:

<form name="form_name" ...>
    ...
    <input name="page" ...>  <!-- or <button> or <textarea> or whatnot -->
    ...
</form>

window.document.form_name.page.value is the current value — the currently-entered text — in the form-element named page . window.document.form_name.page.value是名为page的表单元素中的当前值(当前输入的文本)。

The page is the name of an input field, and value is looking at the value held inside the input field. page是输入字段的名称,而value则是查看输入字段中保存的值。 So the above code will store the value (if any) of the page input field (if it exists) into the variable_name . 因此,以上代码会将页面输入字段(如果存在)的值(如果存在)存储到variable_name

This JSFiddle shows how it works . 这个JSFiddle展示了它是如何工作的

It's setting variable_name to the value of the page field contained in the form_name form. 它将variable_name设置为form_name表单中包含的页面字段的值。 The field, page, may be hidden or visible. 该字段,页面可能是隐藏的或可见的。

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

相关问题 有人可以解释这个电子邮件正则表达式的含义 - Can someone explain what this Email regex means 有人可以解释一下下面条件运算符的语法以及它到底在做什么 - can someone please explain the syntax of the conditional operator below and what exactly it's doing 请解释这段代码的含义 - Please explain what this code means 有人可以用简单的英语解释在sankeyNetwork()中迭代参数的含义吗? - Can someone explain in plain English what the iterations argument means in sankeyNetwork()? 有人可以解释这个javascript(可能是angularJS)语法的含义吗? - Can someone explain what this javascript (possibly angularJS) syntax means? 有人可以解释此代码示例中this.value的含义吗? - Can someone explain what this.value means in this example of code? 有人可以解释定义jQuery插件时的语法含义吗? - Can someone explain what the syntax means when defining a jQuery plugin? 有人可以解释一下这段代码的含义吗? - can somebody explain me what this code means please? Javascript-有人可以向我确切解释这是什么吗? - Javascript - Can someone explain to me exactly what this does? 有人可以解释一下此函数中“ var result = 1”是做什么的吗? - Can someone please explain what “var result=1” is doing in this function?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM