Jump to content

Having Trouble displaying Values


The_Unkown675

Recommended Posts

Ok, so I tried doing running the script below, and all that appeared is the button, any help?

<DOCTYPE html>
<html>
<body>

<p id="start"> </p>

<button onclick="end()"> Click Me To Find 10% more than the number above</button>

<p id="ending"> </p>

<script>

var start_value = 10000 ;

document.getElementById("start").innerHTML = start_value ;

var percent = start_value / 10 ;

var end_value = start_value + percent ;

function end()
	document.getElementById("ending").innerHTML = end_value ;


</script>


</body>

</html>
Link to comment
Share on other sites

function end()

document.getElementById("ending").innerHTML = end_value ;

I don't know if brackets are optional around a one-line function since I've always used them, but if not then you're missing brackets there.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...