Q: How to make a JavaScript result appear on the same page, not in an alert popup window I was wondering instead of using the alert function to show the function result if there was a way to print it in a text field on the same page as the original variable input. Thanks!

A: create a div in your body for result like
<div id="result"></div>

update from script like
var resultDiv = document.getElementById("result");
resultDiv.innerHTML = <your value>


A: Without additional libraries, using only browser functions, you can do this with the document.getElementById() function like this:
<html>
<head>
    <title>test</title>
</head>

<body>
    <input type="text" id="textfield">
</body>

<script>
    function someFunction() {
        return "Hello world!";
    }

    document.getElementById('textfield').value = someFunction();
</script>

<html>

