Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to display a value returned by a js function in a designated place 1

Status
Not open for further replies.

whn

Programmer
Oct 14, 2007
265
US
Experts,

I wrote a small piece of experiment code as follows:

Code:
<html>
<head>
<script type="text/javascript">//<![CDATA[
function verifyQty() {
	var val = document.getElementById("qtyID").value;
	alert('val = ' + val);
	document.getElementById("myID").value;
	return true;
}
</script>
</head>
<body>
<form method="post" action="#" enctype="multipart/form-data" name="msf">
<label> Enter somthing: </label>
<input name="qty" onkeyup="return verifyQty();" id="qtyID">
</input>
<div id='myID'></div>[COLOR=blue] <!-- I want to display the value in this row.-->[/color]
</form>
</body></html>

I know it does not work. Could someone show me the correct way to implement it?
 
Sorry, I had a horrible typo:

What's wrong:
Code:
document.getElementById("myID").value;

What's should be:
Code:
document.getElementById("myID").value = val;
 
>document.getElementById("myID").value = val;
[tt]document.getElementById("myID").innerHTML = val;[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top