[英]pass variable form javascript
有一個隱藏的字段想在圖形中使用該字段的值。 這是可能的? 下面是我使用的代碼示例。
<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 }]
謝謝
您可以按照建議有效地獲得價值。
您的代碼不起作用,因為您只需要關閉函數括號即可:
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.