Using an HTML button to call a JavaScript function

前端 未结 10 1717
我在风中等你
我在风中等你 2020-11-22 09:59

I am trying to use an HTML button to call a JavaScript function.

Here\'s the code:



        
10条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-22 10:33

    Your HTML and the way you call the function from the button look correct.

    The problem appears to be in the CapacityCount function. I'm getting this error in my console on Firefox 3.5: "document.all is undefined" on line 759 of bendelcorp.js.

    Edit:

    Looks like document.all is an IE-only thing and is a nonstandard way of accessing the DOM. If you use document.getElementById(), it should probably work. Example: document.getElementById("RUnits").value instead of document.all.Capacity.RUnits.value

提交回复
热议问题