Guest Gloria Posted January 20, 2006 Share Posted January 20, 2006 I am pretty new to web development and is still trying to figure out all the tweaks. I created a small HTML file as below. The document allows users to enter some text into the text box. It also has a submit button that will retrieve the data from the database and populate in the div section.My question is, how do I populate the value entered in the text box in the legend?<form> Name<input type =text id="txtName" name="txtName"> <input type="submit" value="Submit" name="B1" id="qry"></p></form><fieldset style="WIDTH: 100%; HEIGHT: 75%"><legend>txtName.value</legend><div id="divResults"></div></fieldset></body>Thanks. Link to comment Share on other sites More sharing options...
scott100 Posted January 21, 2006 Share Posted January 21, 2006 Hi Gloria, try this i think it's what you were asking for, works in both IE & FF.<head><script>function check(){content=document.getElementById('txtName').value;document.getElementById('lgd').innerHTML=content;return false;}</script></head><body><form onsubmit="return check()">Name<input type="text" id="txtName" name="txtName" /><input type="submit" value="Submit" name="qry" id="qry"></p></form><fieldset style="width:100%;height:75%"><legend id="lgd">txtName.value</legend><div id="divResults"></div></fieldset></body> Link to comment Share on other sites More sharing options...
Guest Gloria Posted January 26, 2006 Share Posted January 26, 2006 Scott,This is exactly what I'm looking for. Thank you very much!!! By the way, is this function check() a Javascript? Gloria Link to comment Share on other sites More sharing options...
scott100 Posted January 26, 2006 Share Posted January 26, 2006 Yes, check() is a javascript function, javascript can make web pages more interactive and less static.If your familiar with (X)HTML then your next step could be to learn a scripting language, i'd recommend you check out the free tutorials on the w3schools site here: http://www.w3schools.com/js/default.asp Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now