<!DOCTYPE html>
<html lang="en"/>
<head>
<title>Seconds</title>
<meta charset="utf-8"/>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
</head>
<body>
Years <input type="value" name="secs" id="secs"><br>
<input id="sub" type="submit" value="Submit">
<script type="text/javascript">
$(function(){
$('#sub').click(function(){
var years = $('#secs').val();
var secs = years * 365 *24*60*60;
$('body').append( '<p>You have' + secs + 'of life</p>' );
});
});
</script>
</body>
</html>
Errors you had made:
No jQuery included
$(body) should be $('body')
'<p>'"You have"+ secs + "of life"'</p>' should be '<p>You have' + secs + 'of life</p>'
var years = $('#secs').val(); //needed to be within your function otherwise it is calculated on page load NOT when you click button (so will always be 0)