Debt Consolidation - Debt Consolidation - Wordpress Themes - Free Advertising - Find jobs

PDA

View Full Version : Copy some HTML, with input boxes?


Triexa
Dec 2nd 2006, 8:52 am
Say I have:


<div id="abc">
<input type="text" name="myname" value="TEST">
</div>


if I use abc.innerHTML, I won't get the new value for the text field (if changed by the user). What would be the best way to accomplish fetching the new value to "properly" copy the HTML?

ajsa52
Dec 2nd 2006, 9:15 am
Using the "id" and "name" properties with "input" fied. That way works on Explorer and FireFox. Example:

<html>
<body>
<div id="abc">
<input type="text" id="myname" name="myname" value="TEST" size="11" maxlength="20"/>
<br />
<button type="button" onclick="JavaScript: alert( document.getElementById('myname').value );">Alert Value</button>
</div>
</body>
</html>

Triexa
Dec 2nd 2006, 9:20 am
hmm... ya I guess so. I'll just add IDs I guess. Cause I have a lot of input fields. haha

sat123
Feb 23rd 2007, 3:11 am
id(id of textbox).innerHTML or textbox_name.value(to be used bit differently...)