How to get value js

Gets the value returned jsfunction
1, first, create a new file with the HTML5 initialization code, as shown below.
2, to create a new tag H1 receives the JS function of a fallow deer return value.
3. Create a new script tag and create a new function in the tag. Function returns the value 22.
4, in the h1 tag also created a new script tag. STR markers new variable AA receives the return value of the function.
5, the variables receive the return value printed by the "Documents." write (variable) "method.
6. Finally, use your browser to open the index.html file to view the results page, get the JS function return value.
If you have the same name, only one person can do
var v = document.getelementsbyname ( "xx") [0] .value;
it is recommended to add an ID in the input to make it more accurate
var v = document.getelementbyid ( "xxxxx" ) value.;

Guess you like

Origin www.cnblogs.com/blogst/p/11782198.html