DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

tritanngo99
tritanngo99

Posted on

Error when calculating sum of 2 number in JS

I try write JS to calcalculating sum of 2 number in JS, but I get error !
This is mycode:

<!DOCTYPE html>
<HTML>

    <HEAD>
    <TITLE>Thay Δ‘α»•i giΓ‘ trα»‹ của thuα»™c tΓ­nh</TITLE>
    <META http-equiv="Content-Type" content="text/html; charset=utf-8">
    </HEAD>

    <BODY>
    <h2>HΓ£y nhαΊ­p hai sα»‘ vΓ  click vΓ o nΓΊt TΓ­nh tα»•ng</h2>
    <INPUT type="text" name="SoHang1" > +
    <INPUT type="text" name="SoHang2"> =
    <INPUT type="text" name="KetQua">
    <INPUT type="button" value="Sum"
    onClick="KetQua.value = parseFloat(SoHang1.value) + parseFloat(SoHang2.value)">
    </BODY>

    </HTML>
Enter fullscreen mode Exit fullscreen mode

So, I hope everyone can help me fix this error ! Thanks !

Top comments (0)

🌚 Life is too short to browse without dark mode