+ 1
I have problems with Javascript on my codes :-(
4 ответов
+ 8
https://code.sololearn.com/W6UwZ1nc6JOY/?ref=app
sorry for late.. i update ur code..
+ 5
You have several issues.
1. function shouldn't be capitalized.
2. the ids need to be in quotes. 
3. the id for b doesn't match
4. you should move the entire script tag to the bottom of the body so that the DOM has been created and the elements you're trying to access exist - good habit.
5. You need to convert the inputs to int or float etc to perform a mathematical operation on them instead of concatenating them.
shoul look like this when done:
<!DOCTYPE html>
<html>
    <head>
        <title>Page Title</title>
        
    </head>
    
    <body>
    
    <input id="ipta" />
    <input id="iptb" />
    
    <button onclick="plus()">Push</button>
    
    <p id="result"></p>
    
    <script language="Javascript" type="text/javascript">
    
        function plus() {
            var a = parseInt(document.getElementById('ipta').value);
            var b = parseInt(document.getElementById('iptb').value);
            var c = a + b ;
            document.getElementById('result').innerHTML = c;
}
        </script>
        
    </body>
</html>
+ 2
Thanks guy
Lots of mistakes 😅
+ 1
function has a capital F, should be lower case. I think you also need quotes in your document.getelementbyid parameters



