document.variable role

Asked 1 years ago, Updated 1 years ago, 32 views

document. The variable role is unknown.
http://cya.sakura.ne.jp/java/calc.htm
I am studying javascript while looking at the site.

 document.myForm.myLine.value=myInput;

I don't know what the line is doing.
"The description says ""Display the value you are currently entering"", but why do I write "" document.variable…"" to display the value in html?"

The document came out when I checked that HTML elements that make up the web page can be easily accessed from the program, but how do you access them in this case?

javascript

2022-09-30 19:57

2 Answers

You can't tell that by looking at the definition of the function function myValue(myData).
I think the HTML code is written at the back, but I think you can find name=myForm and name=myLine.
In function myValue(myData), myFrom and myLine refer to that part of the HTML code.

In other words, document.myForm.myLine.value represents the <formname="myForm">>...</form> table of <<input type="text"size="12"name="myLine"value="0">code> in HTML.


2022-09-30 19:57

Because the Document object corresponds to named properties

<form name="myForm"...>

You can access the element in document.myForm if is present.
Similarly, the Form element corresponds to named properties, so

<form name="myForm"...>
  ...
  <input name="myLine".../>
  ...
</form>

You can access the element in document.myForm.myLine if is present.


2022-09-30 19:57

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.