[英]pass variable form javascript
there is a hidden field would like to use the value of this field in the graph. 有一个隐藏的字段想在图形中使用该字段的值。 it's possible?
这是可能的? Below is an example of code that I used.
下面是我使用的代码示例。
<input type="hidden" name="valor" id="valor" value="20" />
window.onload = function () {
var teste = (document.getElementById("valor").value);
dataPoints: [
{ label: "apple", y: 10 },
{ label: "grape", y: teste }]
thank you 谢谢
You can effectively get value as you suggest. 您可以按照建议有效地获得价值。
Your code do not work because you just need to close your function braces : 您的代码不起作用,因为您只需要关闭函数括号即可:
window.onload = function () {
var teste = document.getElementById("valor").value;
dataPoints: [
{ label: "apple", y: 10 },
{ label: "grape", y: teste }
];
} // <= here
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.