Basic javascript Fahrenheit/Celsius calculator

后端 未结 2 1026
既然无缘
既然无缘 2021-01-13 13:47

I\'m trying to do a Celsius/Fahrenheit conversion calculator, with a button for each conversion and the result being displayed in the appropriate textbox. I must be missing

2条回答
  •  野的像风
    2021-01-13 14:29

    You are querying the DOM with the document.getElementById() function, but both input elements don't currently have an id attribute only a name attribute. So in your example, there are no elements that actually match the IDs you're passing to the function.

    You should set the id attributes of both elements like so:

    
    
    
    

提交回复
热议问题