I have html document. In that document I have some code that looks like the following:
<tr>
<td>Name:</td>
<td>
<div class="Data" id="login_name">
<input type=text></input>
</div>
</td>
</tr>
The user enters in their login name (and their password in another input box not shown here) and presses a button on the page that says "login". The button has onclick="login(); function. In "login()" to access what the user entered in the input box by accessing the DOM tree. Here is what I am doing right now.
// the login is actually a var that can contain the login
// name or password. This returns an object
var element = document.getElementById("login_name");
// child = INPUT, which it should
var child = element.firstChild.nodeName;
[don't know what the next line here should be]
What I am trying to do is access is the value a user types into the input box. I can look at the DOM tree and see:
+ DIV = Name
IV Type:ELEMENT_NODE Att:class=Data,id=login_name
INPUT - Name:INPUT Type:ELEMENT_NODE Att: value=bob
note that the user here types bob in thee login text area. I've tried various ways to access this "bob" value but cannot find the correct method. I will need to be able to read/write this text area. Should I change my actual HTML and put XML tags around the <input type=text></input> to something like <LOGINNAME><input type=text></input></LOGINNAME> and this will create a way to access the value in the input box? Any help would be appreciated.
Thanks in advance,
Joe Crew
[ Ajith disabled smilies in the post so that the colon prefixed characters are not interpreted as UBB images ]
[This message has been edited by Ajith Kallambella (edited April 26, 2001).]