How to make output answer sentences input and output box textarea with Java HTML CSS for your blogger?
In this post you learn how to create a simple HTML JAVASCRIPT and CSS page or using as a post on your blogger with a text input box, a button, and a textarea to display the output using Java and HTML, you can follow the example below:
Code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Java HTML Output Answer</title>
<style>
body {
font-family: Arial, sans-serif;
text-align: center;
margin: 20px;
}
#output {
width: 80%;
height: 100px;
margin-top: 10px;
}
</style>
</head>
<body>
<h2>Java HTML Output Answer</h2>
<label for="inputText">Input:</label>
<input type="text" id="inputText" placeholder="Enter your question">
<button onclick="getAnswer()">Get Answer</button>
<br>
<label for="output">Output Answer:</label>
<textarea id="output" readonly></textarea>
<script>
function getAnswer() {
// Get the input text
var inputText = document.getElementById("inputText").value;
// TODO: Implement your Java logic to generate the answer
// For simplicity, let's just echo the input as the answer
var outputAnswer = "Answer: " + inputText;
// Display the output in the textarea
document.getElementById("output").value = outputAnswer;
}
</script>
</body>
</html>
Comments :
Post a Comment