[英]How to pass multiple parameters to a function from HTML during Onclick
我想在Onclick期間通過ID將HTML參數傳遞給一個函數
onclick="total(document.getElementById('start').value,document.getElementById('finish').value,document.getElementById('break').value)"
但這給了我一個錯誤
total不是HTMLButtonElement.onclick(auth.html:42)onclick @ auth.html上的函數:42
為什么不在函數中拾取dom值。
onclick="total()"
function total()
{
var inputa = document.getElementById('start').value;
var inputb = document.getElementById('finish').value;
var inputc = document.getElementById('break').value;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.