Javascript help
#3
(05-27-2019, 12:10 PM)Arny Wrote: Maybe this?

Code:
document.getElementsByName('name').value;


Code:
<html>
    <form>
        <input name="numb" type="number">
        <button onclick="getValue()">run</button>

    </form>
<script>

function getValue() {
 var x = document.getElementsByName("numb")[0].tagName;
    document.getElementById('show').innerHTML = x;
    
    getStories()
}

var height
var storySize = 2.8

var getStories = function(storyCount){

    storyCount = height / storySize
    
    console.log("The height of the building is " + height + "m")
    console.log("The building has " + Math.trunc(storyCount) + " stories")
    console.log("the height of each story is " + storySize +"m")
    
}
</script>
<p id="show"></p>

</body>
</html>

I've tried this now
[Image: h2.png]
Visit my profile here.


Messages In This Thread
Javascript help - by Haarek - 05-27-2019, 11:28 AM
RE: Javascript help - by Luna - 05-27-2019, 12:10 PM
RE: Javascript help - by Haarek - 05-27-2019, 12:38 PM
RE: Javascript help - by dawson270500 - 05-29-2019, 03:01 PM
RE: Javascript help - by Haarek - 06-02-2019, 09:51 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)