May 31
An effective way of performing script input and output operations is through use of textbox fields. You can use textboxes, as input areas into which users enter information, and you can use them as areas to display script output.
JAVASCRIPT:
-
<script type="text/javascript">
-
-
function Assign()
-
{
-
document.getElementById("OutputField").value =
-
"Here is the output message.";
-
}
-
-
</script>
-
-
<input id="OutputField" type="text" style="width:200px"/>
-
<input type="button" value="Assign Value" onclick="Assign()"/>
In a like manner, you can determine the current contents of a textbox. The following script displays the contents of the previous textbox in an accompanying area.
JAVASCRIPT:
-
<script type="text/javascript">
-
-
function Show()
-
{
-
document.getElementById("OutputArea").innerText =
-
"The value in the textbox is \"" +
-
document.getElementById("OutputField").value +
-
"\"";
-
}
-
-
</script>
-
-
<input type="button" value="Show Value" onclick="Show()"/>
-
<span id="OutputArea"></span>
Recent Comments