469,641 Members | 1,534 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,641 developers. It's quick & easy.

How to return data to a field - DOM

I am really stuck...

Just want to populate a text field with the data from a drop-down, simple eh.
But...the name of the field is "1", no I didn't, but I cannot change it, without days of re-coding Perl.

The simple page I have now is:
<script language=Javascript>
function Choice()
var populateData = document.getElementById("dataSourceID").value;
<!-- alert(populateData); //-->

<select name="dataSource" id="dataSourceID" onChange="Choice();">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>

<input type=text name="1" id="destinationData">


What I am trying to do is to populate "destinationData" with the selection made from "dataSource".

Any help appreciated,
thank you.
Jan 25 '07 #1
2 1233
check this code out!!! :

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <script language=Javascript>
  4. function Choice()
  5. {
  6. var populateData = document.getElementById("dataSourceID").value;
  7. document.getElementById("destinationData").value = populateData;
  8.  alert(populateData); 
  9. }
  10. </script>
  11. </head>
  12. <body>
  14. <form>
  15. <select id="dataSourceID" onChange="Choice();">
  16. <option value="1">1</option>
  17. <option value="2">2</option>
  18. <option value="3">3</option>
  19. </select>
  20. <input type=text id="destinationData">
  21. </form>
  22. </body>
  23. </html>
Any troubles still?? reply me :)
-- Abdel Olakara
Jan 25 '07 #2
So simple, I will take less medication tomorrow!

Thank you
Jan 25 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Von Bailey | last post: by
7 posts views Thread by hugo27 | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.