473,385 Members | 1,312 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

appending to variable using document.getElementById

127 100+
Hi,

I have a JS function which includes the following lines:

Expand|Select|Wrap|Line Numbers
  1. var table = document.getElementById("table1");
  2. var cells = table.getElementsByTagName("div");
  3. for (i = 0; i < cells.length; i++) {
  4. checkedCels = cells[i].id;
  5. var checkboxes = cells[i].getElementsByTagName("input");
  6.  
Is it possible to set "var table" from more than 1 table (i.e., "table2")? I tried to include the line "var table += document.getElementById("table2");", but it didn't work.

Thanks for any suggestions!
Feb 16 '08 #1
45 9428
wyatt
6
The following should do what you're looking for:

Expand|Select|Wrap|Line Numbers
  1. var table = document.getElementById("table1");
  2. var cells = table.getElementsByTagName("div");
  3.  
  4. table = document.getElementById("table2");
  5. var cells2 = table.getElementsByTagName("div");
  6.  
  7. var cells = cells.concat(cells2);
  8.  
  9. for (i = 0; i < cells.length; i++) {
  10. checkedCels = cells[i].id;
  11. var checkboxes = cells[i].getElementsByTagName("input");
  12.  
Feb 18 '08 #2
phub11
127 100+
Thanks for the response; however, that doesn't seem to handle the variables the way I'd like. Below is more along the lines of what I *think* I need.

If possible, could someone please fix the syntax? I can't seem to get the assignment checks to work.

Thanks!

Expand|Select|Wrap|Line Numbers
  1. function createOrder() {
  2. var checkedData = "";
  3. ////var table = document.getElementById("table1");
  4. ////var cells = table.getElementsByTagName("div");
  5. var table1 = document.getElementById("table1");
  6. var table10 = document.getElementById("table10");
  7. if (table1.value != 'undefined') {
  8. var cells = table1.getElementsByTagName("div");
  9. } else if (table10.value != 'undefined') {
  10. var cells = table10.getElementsByTagName("div");
  11.  
Feb 20 '08 #3
acoder
16,027 Expert Mod 8TB
So you want table1 OR table10, not table1 AND table10? Note that a table doesn't have a value.
Feb 20 '08 #4
phub11
127 100+
Hi!

I'd prefer to have table1 AND table 10 (sorry about the numbering - it's on a log scale!). Any ideas?

Thanks!
Feb 20 '08 #5
phub11
127 100+
Hi!

I'd prefer to have table1 AND table 10 (sorry about the numbering - it's on a log scale for some reason!). I thought OR would work as it loops each time and appends to an array.

Any ideas?

Expand|Select|Wrap|Line Numbers
  1. function createOrder() {
  2. var checkedData = "";
  3. ////var table = document.getElementById("table1");
  4. ////var cells = table.getElementsByTagName("div");
  5. var table1 = document.getElementById("table1");
  6. var table10 = document.getElementById("table10");
  7. if (table1.value != 'undefined') {
  8. var cells = table1.getElementsByTagName("div");
  9. } else if (table10.value != 'undefined') {
  10. var cells = table10.getElementsByTagName("div");
  11. }
  12. for (i = 0; i < cells.length; i++) {
  13. checkedCels = cells[i].id;
  14. var checkedNams = "";
  15. var checkedVals = "";
  16. var checkedScreen = "";
  17. var checkboxes = cells[i].getElementsByTagName("input");
  18. for (j = 0; j < checkboxes.length; j++) {
  19. if (checkboxes[j].checked) {
  20. checkedNams += checkboxes[j].name;
  21. }
  22. checkedVals = checkboxes[j].value;
  23. checkedScreen = checkboxes[0].value;
  24. //MIGHT NEED TO POP OFF FIRST ELEMENT IN checkboxes[].value TO REMOVE screen[]
  25. }
  26. //if ( checkedVals != "" ){
  27. checkedData = checkedData.concat(checkedCels + checkedScreen + checkedNams + checkedVals)
  28. //        }
  29. }
  30. document.form1.sendData.value = checkedData;
  31. }
  32.  
Thanks!
Feb 20 '08 #6
acoder
16,027 Expert Mod 8TB
I'd prefer to have table1 AND table 10 (sorry about the numbering - it's on a log scale for some reason!). I thought OR would work as it loops each time and appends to an array.
If you want both, why wouldn't the code posted by wyatt not work? It takes the divs from table10 and concatenates them to the divs from table1.

What are you trying to test in the following lines:
Expand|Select|Wrap|Line Numbers
  1. if (table1.value != 'undefined') {
  2. var cells = table1.getElementsByTagName("div");
  3. } else if (table10.value != 'undefined') {
  4. var cells = table10.getElementsByTagName("div");
  5. }
  6.  
A table doesn't have a value attribute.
Feb 20 '08 #7
phub11
127 100+
Hi! I just retried wyatts code, and the array "checkedData" is blank - even if I include a string. Still, I appreciate wyatt's suggestion.

The code you referenced was an attempt to avoid using "concat". I thought that it would set "cells" using the original code which works, depending on which table I had dragged the draggable to.

Here is the code with wyatts suggestion which does not appear to work. More suggestions please!:

Expand|Select|Wrap|Line Numbers
  1. function createOrder() {
  2. var checkedData = "";
  3. //THIS WORKS WITH 1 TABLE//var table = document.getElementById("table1");
  4. //THIS WORKS WITH 1 TABLE//var cells = table.getElementsByTagName("div");
  5. //var table1 = document.getElementById("table1");
  6. //var table10 = document.getElementById("table10");
  7. //if (table1.value != 'undefined') {
  8. //var cells = table1.getElementsByTagName("div");
  9. //} else if (table10.value != 'undefined') {
  10. //var cells = table10.getElementsByTagName("div");
  11. //}
  12.  
  13. var table = document.getElementById("table1");
  14. var cells = table.getElementsByTagName("div");
  15. table = document.getElementById("table10");
  16. var cells2 = table.getElementsByTagName("div");
  17. var cells = cells.concat(cells2);
  18.  
  19. for (i = 0; i < cells.length; i++) {
  20. checkedCels = cells[i].id;
  21. var checkedNams = "";
  22. var checkedVals = "";
  23. var checkedScreen = "";
  24. var checkboxes = cells[i].getElementsByTagName("input");
  25. for (j = 0; j < checkboxes.length; j++) {
  26. if (checkboxes[j].checked) {
  27. checkedNams += checkboxes[j].name;
  28. }
  29. checkedVals = checkboxes[j].value;
  30. checkedScreen = checkboxes[0].value;
  31. //MIGHT NEED TO POP OFF FIRST ELEMENT IN checkboxes[].value TO REMOVE screen[]
  32. }
  33. //if ( checkedVals != "" ){
  34. checkedData = checkedData.concat(checkedCels + checkedScreen + checkedNams + checkedVals")
  35. //        }
  36. }
  37. document.form1.sendData.value = checkedData;
  38. }
  39.  
Feb 20 '08 #8
acoder
16,027 Expert Mod 8TB
Hi! I just retried wyatts code, and the array "checkedData" is blank - even if I include a string.
And it's not blank when using one table?

The code you referenced was an attempt to avoid using "concat". I thought that it would set "cells" using the original code which works, depending on which table I had dragged the draggable to.
Another alternative is to get the elements from the parent of the tables, thus avoiding concatenation.
Feb 21 '08 #9
phub11
127 100+
The code doesn't work with just 1 table either, even if I do:

Expand|Select|Wrap|Line Numbers
  1. var cells2 = "";
  2.  
Could you please show me example code of how this alternative method works?

Thanks!
Feb 21 '08 #10
acoder
16,027 Expert Mod 8TB
concat expects an array (or a number of arrays). Test by alerting the cell ids one by one.
Feb 21 '08 #11
phub11
127 100+
Thanks for the suggestion. I have multiple tables with a total of 96 cells. I've tried the following, but I have no idea how to assign "checkedCels" and "checkboxes".

Expand|Select|Wrap|Line Numbers
  1. function createOrder() {
  2. var checkedData = "";
  3. var cells = new Array();
  4. //var table = document.getElementById("table1");
  5. //var cells = table.getElementsByTagName("div");
  6. for (k = 0; k < 95; k++) {
  7. cells[k] = "cell"+(k+1);
  8. }
  9.  
  10. for (i = 0; i < cells.length; i++) {
  11. checkedCels = cells[i].id;
  12. var checkedNams = "";
  13. var checkedVals = "";
  14. var checkedScreen = "";
  15. var checkboxes = cells[i].getElementsByTagName("input");
  16.  
Feb 21 '08 #12
phub11
127 100+
Just figured it out.

All I had to do was repeat the whole function for each table, but without resetting "checkedData".

Thanks for your help. Hopefully I can get it to work properly on IE.

Cheers!
Feb 21 '08 #13
acoder
16,027 Expert Mod 8TB
Just figured it out.

All I had to do was repeat the whole function for each table, but without resetting "checkedData".

Thanks for your help. Hopefully I can get it to work properly on IE.

Cheers!
Oh right, you were resetting checkedData each time! Can you post the revised code. Perhaps we can get it to work in IE.
Feb 22 '08 #14
phub11
127 100+
The (abridged) code:

Expand|Select|Wrap|Line Numbers
  1. function createOrder() {
  2. var checkedData = "";
  3. var table = document.getElementById("table1");
  4. var cells = table.getElementsByTagName("div");
  5. for (i = 0; i < cells.length; i++) {
  6. checkedCels = cells[i].id;
  7. var checkedNams = "";
  8. var checkedVals = "";
  9. var checkedScreen = "";
  10. var checkboxes = cells[i].getElementsByTagName("input");
  11. for (j = 0; j < checkboxes.length; j++) {
  12. if (checkboxes[j].checked) {
  13. checkedNams += checkboxes[j].name;
  14. }
  15. checkedVals = checkboxes[j].value;
  16. checkedScreen = checkboxes[0].value;
  17. //MIGHT NEED TO POP OFF FIRST ELEMENT IN checkboxes[].value TO REMOVE screen[]
  18. }
  19. //if ( checkedVals != "" ){
  20. checkedData = checkedData.concat(checkedCels + checkedScreen + checkedNams + checkedVals)
  21. //        }
  22. }
  23.  
  24. var table = document.getElementById("table10");
  25. //----REPEAT AS BEFORE----
  26. //END
  27. }
  28. document.form1.sendData.value = checkedData;
  29. }
  30.  
The problem with IE is the way it handles the draggables (which are defined using scriptaculous). The value assigned to a selected checkbox using a drop down within the object isn't passed when using IE6 (i.e., after the object it cloned, the clones can't assign a value - only the original template).

It would be great if you could help me on that one.

Thanks!
Feb 22 '08 #15
acoder
16,027 Expert Mod 8TB
The problem with IE is the way it handles the draggables (which are defined using scriptaculous). The value assigned to a selected checkbox using a drop down within the object isn't passed when using IE6 (i.e., after the object it cloned, the clones can't assign a value - only the original template).
For IE, get the checked property (true/false) of the checkboxes and put them in the array, then loop over the array to set the checked property of the clones.

Just two notes on the code. It could be optimised as you wanted in the original question, but we could leave that for another time.

Secondly, should checkedVals be in the loop rather than outside?
Feb 22 '08 #16
phub11
127 100+
I will try to figure out the IE code, but JS is much harder to learn than PHP! If you have any pointers, that would be great!

Not sure about your question - checkedVals is set/reset in the i loop - defined in the j loop - then appended onto a string - which is then put in an array. This is repeated for each table.

Cheers!
Feb 22 '08 #17
acoder
16,027 Expert Mod 8TB
I will try to figure out the IE code, but JS is much harder to learn than PHP! If you have any pointers, that would be great!
Check out some of the links in the Offsite Links thread (sticky at the top of this forum) - the w3schools website should be good for starting out.

Not sure about your question - checkedVals is set/reset in the i loop - defined in the j loop - then appended onto a string - which is then put in an array. This is repeated for each table.
Sorry, I meant within the if-statement. I see that checkedNams is only appended to if the checkbox is checked. Should checkedVals be appended to in the same manner or for all values?
Feb 22 '08 #18
phub11
127 100+
Hi again!

I'm not having much luck with fixing the IE problem. I gave up trying to figure out how to implement acoder's suggestion as I was not sure what I was doing!

Anyway, I've tracked the issue down to being a problem with how "value" is passed from the selection to the check box using DHTML. Could you please help me out with the following code (or provide some more suggestions) - it works fine in FF2:

Expand|Select|Wrap|Line Numbers
  1. function createOrder()
  2. {
  3. var table = document.getElementById("table1");
  4. var cells = table.getElementsByTagName("div");
  5. checkedData = "";
  6. checkedVals = "";
  7. //for (i = 0; i < cells.length; i++) {
  8. for (i = 0; i < 1; i++) {
  9. checkedCels = cells[i].id;
  10. var checkboxes = cells[i].getElementsByTagName("input");
  11. for (j = 0; j < checkboxes.length; j++) {
  12. if (checkboxes[j].checked) {
  13. checkedVals = checkboxes[j].value;
  14. checkedData = checkedData.concat("Cell:" + checkedCels + " and Value:" + checkedVals);
  15. }
  16. }
  17. }
  18. document.getElementById("order").value=checkedData;
  19. }
  20.  
  21. function updateValue() {
  22. document.getElementById('box1').value = document.getElementById('selectField').value;
  23. }
  24.  
...and...

Expand|Select|Wrap|Line Numbers
  1. <select name="conditions_list" id="selectField" onChange="updateValue();">
  2. <option value="0">0</option>
  3. <option value="1">1</option>
  4. <option value="2">2</option>
  5. <option value="3">3</option>
  6. </select>
  7. <br>
  8. <input type="checkbox" name="coffee" value="" id="box1">box1<br />
  9. </div>
  10.  
Thanks!
Feb 27 '08 #19
acoder
16,027 Expert Mod 8TB
For IE, get the checked property (true/false) of the checkboxes and put them in the array, then loop over the array to set the checked property of the clones.
What I meant here was something like this:
Expand|Select|Wrap|Line Numbers
  1. // get checkboxes' checked property
  2. var checked = [];
  3. for (i = 0; i < checkboxes.length; i++) { // assuming checkboxes contains checkboxes
  4.   checked[i] = checkboxes.checked;
  5. }
  6. // ...then when checkboxes cloned, reset their checked properties:
  7. // assuming same number of checkboxes
  8. for (i = 0; i < clonedCheckboxes.length; i++) {
  9.   clonedCheckboxes[i].checked = checked[i];
  10. }
Feb 28 '08 #20
phub11
127 100+
Thanks for the reply. I *think* I see what you are suggesting - set up an array based on the number of checkboxes made by drag-drop; then reassign them to the cloned states (sorry if I'm way off base!):

However, I'm not sure how to assign "clonedCheckboxes". I Googled scriptaculous to see how it handles cloned objects - the following web page seems to suggest how it's done, but my JS experience it insufficient to make sense of it:

http://wiki.script.aculo.us/scriptac...Droppables.add
(function asignDragAndDrop)

Could you (or some other kind soul) nurse me through this?
Feb 28 '08 #21
acoder
16,027 Expert Mod 8TB
Actually, there is another way: using the defaultChecked property. Have you tried it with that?
Feb 28 '08 #22
phub11
127 100+
Just Googled it and found a nice example:

http://www.java2s.com/Code/JavaScript/Form-Control/defaultCheckedExample.htm

However, I'm still not sure if it will solve the problem of assigning "value" to cloned objects. I'll give it a try though!
Feb 28 '08 #23
phub11
127 100+
Hi again!

Still no luck! Looks like it behaves in an identical manner to the "checked" property.
Feb 28 '08 #24
acoder
16,027 Expert Mod 8TB
Ah, I see, it's the value, not the checked property. Have you checked that the checked property is being passed properly because the value isn't set if the checkbox is not checked.

I'm not sure if IE6 has a problem with the value property of dynamically created checkboxes too. If it does have, you can probably use the same array time method.

If that doesn't work, can you post a link to a test page.
Feb 29 '08 #25
phub11
127 100+
The following shows that the code works fine in FF2, and that after cloning, the status of the checkbox is determined correctly in IE6, but that IE6 doesn't read the "value" from the drop down in the clone correctly.

Go to the main page: page for a day (one word - no spaces)
Then go to: checkbox.html

Thanks for your help!
Feb 29 '08 #26
acoder
16,027 Expert Mod 8TB
The most probable reason for that is that you have multiple ids. Each dragged checkbox and select element have the same ids (box1 and selectField).

When the clones are created, you need to give them unique IDs.

You could change updateValue() to not require the ID, e.g. by passing 'this' to the function.
Feb 29 '08 #27
phub11
127 100+
Thanks for the suggestion!

The "current object" concept seems rather confusing to me - I'm much more comfortable assigning specific variables. Could you see where I am going wrong with the following?:

Expand|Select|Wrap|Line Numbers
  1. function updateValue(input) {
  2. //document.getElementById('box1').value = document.getElementById('selectField').value;
  3. //input.value = document.getElementById('selectField').value;
  4. document.getElementById('box1').value = input.value;
  5. }
  6.  
  7.  
  8. <div id="l1">
  9. <select name="conditions_list" onChange="updateValue(this);">
  10. <option value="0">0</option>
  11. <option value="1">1</option>
  12. <option value="2">2</option>
  13. <option value="3">3</option>
  14. </select>
  15. <br>
  16. <input id="box1" name="test" type="checkbox" value="">box1<br>
  17. </div>
  18.  
Thanks!
Mar 3 '08 #28
acoder
16,027 Expert Mod 8TB
If there's only one checkbox in the containing element, you can use something like:
Expand|Select|Wrap|Line Numbers
  1. function updateValue(input) {
  2. var parent = input.parentNode;
  3. parent.getElementsByTagName("input")[0].value = input.value;
  4. }
Mar 4 '08 #29
phub11
127 100+
Hooray, it works - thanks!

With multiple checkboxes it looks like I can treat it as an array.

Thank you so much!
Mar 4 '08 #30
acoder
16,027 Expert Mod 8TB
You're welcome. Glad you got it working.
Mar 5 '08 #31
phub11
127 100+
One last question on this topic:

Say I wanted to add multiple drop-downs in the draggable object, how would I do it? I've tried to combine into one array and then splitting afterwards, but it doesn't work:

Expand|Select|Wrap|Line Numbers
  1. function updateValue(input) {
  2. //document.getElementById('box1').value = document.getElementById('selectField').value;
  3. //input.value = document.getElementById('selectField').value;
  4. //document.getElementById('box1').value = input.value;
  5. var parent = input.parentNode;
  6. parent.getElementsByTagName("input")[1].value = input.value;
  7. parent.getElementsByTagName("input")[2].value = input.value;
  8. }
  9.  
  10. function updateScreen(input1) {
  11. //document.getElementById('screen').value = document.getElementById('selectScreen').value;
  12. var parent = input.parentNode;
  13. parent.getElementsByTagName("input")[0].value = input1.value;
  14. }
  15.  
  16. <div id="l1">
  17. <select name="screens_list" id="selectScreen" onChange="updateScreen(this);">
  18. <option value="Option A">Option A</option>
  19. </select>
  20. <select name="conditions_list" onChange="updateValue(this);">
  21. <option value="0">0</option>
  22. <option value="1">1</option>
  23. <option value="2">2</option>
  24. <option value="3">3</option>
  25. </select>
  26. <br>
  27. <input id="box1" name="test" type="checkbox" value="">box1<br>
  28. <input id="box2" name="test" type="checkbox" value="">box2<br>
  29. </div>
  30.  
Thanks!
Mar 5 '08 #32
acoder
16,027 Expert Mod 8TB
In updateScreen, it should be: var parent = input1.parentNode;
Mar 5 '08 #33
phub11
127 100+
Hi!

I've tried that, but no luck. I've also tried the following:

Expand|Select|Wrap|Line Numbers
  1. function updateValue(input, scrn) {
  2. //document.getElementById('box1').value = document.getElementById('selectField').value;
  3. var parent = input.parentNode;
  4. parent.getElementsByTagName("input")[0].value = input.value;
  5. var parent = scrn.parentNode;
  6. parent.getElementsByTagName("input")[0].value = scrn.value;
  7. }
  8.  
  9. <div id="l1">
  10. <select name="screens_list" onChange="updateValue(srcn);">
  11. <option value="Option A">Option A</option>
  12. </select>
  13. <select name="conditions_list" onChange="updateValue(this);">
  14. <option value="0">0</option>
  15. <option value="1">1</option>
  16. <option value="2">2</option>
  17. <option value="3">3</option>
  18. </select>
  19. <br>
  20. <input id="box1" name="test" type="checkbox" value="">box1<br>
  21. <input id="box2" name="test" type="checkbox" value="">box2<br>
  22. </div>
  23.  
Any ideas?

Thanks!
Mar 5 '08 #34
acoder
16,027 Expert Mod 8TB
Say I wanted to add multiple drop-downs in the draggable object, how would I do it? I've tried to combine into one array and then splitting afterwards, but it doesn't work
Are you having problems with dragging the drop downs or with updating the values of checkboxes when there are multiple drop downs?

Also, should the drop-downs update the same checkbox(es) or different ones?
Mar 5 '08 #35
phub11
127 100+
The following works fine in FF2, and now passes the value of the checked checkboxes correctly in IE6, but doesn't pass the value of the "screen" drop-down, which is included in the same draggable. I think the problem is related to IE6 not passing "input1.value" to the checkboxes[] array :

Expand|Select|Wrap|Line Numbers
  1. var checkboxes = cells[i].getElementsByTagName("input");
  2. for (j = 0; j < checkboxes.length; j++) {
  3. if (checkboxes[j].checked) {
  4. checkedNams += checkboxes[j].name;
  5. checkedVals = checkboxes[j].value;
  6. checkedScreen = checkboxes[0].value;
  7. checkedData = checkedData.concat(checkedCels + " with checked boxes " + checkedNams + " and Value:" + checkedVals + " and Option:" + checkedScreen);
  8. }
  9. }
  10.  
  11. function updateValue(input) {
  12. //document.getElementById('box1').value = document.getElementById('selectField').value;
  13. //document.getElementById('box2').value = document.getElementById('selectField').value;
  14. var parent = input.parentNode;
  15. parent.getElementsByTagName("input")[1].value = input.value;
  16. parent.getElementsByTagName("input")[2].value = input.value;
  17. }
  18.  
  19. function updateScreen(input1) {
  20. //document.getElementById('screen').value = document.getElementById('selectScreen').value;
  21. var parent1 = input1.parentNode;
  22. parent1.getElementsByTagName("input")[0].value = input1.value;
  23. }
  24.  
  25. <div id="l1">
  26. <select name="screens_list" onChange="updateScreen(this);">
  27. <option value="Option A">Option A</option>
  28. </select>
  29. <input id="screen" name="screen[]" value="" type="hidden">
  30. <select name="conditions_list" onChange="updateValue(this);">
  31. <option value="0">0</option>
  32. <option value="1">1</option>
  33. <option value="2">2</option>
  34. <option value="3">3</option>
  35. </select>
  36. <br>
  37. <input id="box1" name="box1" type="checkbox" value="">box1<br>
  38. <input id="box2" name="box2" type="checkbox" value="">box2<br>
  39. </div>
  40.  
Thanks!
Mar 5 '08 #36
acoder
16,027 Expert Mod 8TB
The following works fine in FF2, and now passes the value of the checked checkboxes correctly in IE6, but doesn't pass the value of the "screen" drop-down, which is included in the same draggable. I think the problem is related to IE6 not passing "input1.value" to the checkboxes[] array
If I follow correctly, you want to set the hidden form field (ID screen) to the value of the screen drop-down?
Mar 5 '08 #37
phub11
127 100+
Yes!

So all the checkbox(es) of a given dropped cell have the same number and screen name assigned to them.

Actually, I don't need a drop-down for screen, as it's only 1 choice (for the given draggable - each type of draggable has a different "screen" variable assigned to it). I couldn't figure out how to do it any other way.

P.S: I can't seem to get "screen" to pass using the new code in FF2 now!?!
Mar 5 '08 #38
acoder
16,027 Expert Mod 8TB
Actually, I don't need a drop-down for screen, as it's only 1 choice (for the given draggable - each type of draggable has a different "screen" variable assigned to it). I couldn't figure out how to do it any other way.
In that case, just keep and set a hidden variable in each cell when the elements are dragged into it - no need for the second drop-down.
Mar 5 '08 #39
phub11
127 100+
Yeah, I had thought of that at the beginning, but never figured it out (being a JS newbie), so followed the INPUT route!

Finally managed to figure out how to pass an HTML variable to JS - it's so simple!!!

<script>
var checkedScreen = "OptionA";
</script>

Thanks for all your patience!

P.S: I have another thread running about anchors in scrollable div's. Any experience with that?!
Mar 6 '08 #40
phub11
127 100+
SCRATCH THAT!!!

If you have multiple draggables, the last variable in the list is defined for all draggables.

Looks like my old way would solve this problem if I could get multiple drop-downs in a draggable to work!!!
Mar 6 '08 #41
acoder
16,027 Expert Mod 8TB
If you have multiple draggables, the last variable in the list is defined for all draggables.
Why not set the target hidden element when the drag takes place, e.g. if dragged to cell1, set the hidden element value already in cell1 to "OptionA" or whatever.
Mar 6 '08 #42
phub11
127 100+
The idea is to have multiple draggables, with "screen" being set differently for each type of draggable.
Mar 6 '08 #43
acoder
16,027 Expert Mod 8TB
So with multiple drop-downs, how are you differentiating between each draggable?
Mar 6 '08 #44
phub11
127 100+
Hi acoder,

To avoid making this thread way too long I PM'd you last week. Please let me know if you'd prefer me to add to this thread instead?
Mar 10 '08 #45
acoder
16,027 Expert Mod 8TB
Sorry, this went off my radar. I'll try to have a look at this later.
Mar 11 '08 #46

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

Similar topics

3
by: Byron | last post by:
Hi, Javascript confuses me, so I usually limit myself to Dreamweaver's built-in scripts for stuff like imageswaps. But this time I'm trying to write something very simple myself. I do most of my...
6
by: adamrfrench | last post by:
Let it be mentioned that Javascript is not my forte, so the solution to this could very well be a simple one. I am working on an AJAX function where I can pass a URL and the target ID in, and...
20
by: weston | last post by:
I've got a piece of code where, for all the world, it looks like this fails in IE 6: hometab = document.getElementById('hometab'); but this succeeds: hometabemt =...
6
by: paul | last post by:
HI! How do we send a variable from an Iframe page back to its parent? I have a script that calculates the iframe's window size but I need to know how to send that value back to its parent so I...
11
by: ctman770 | last post by:
Hi Everyone, Is it faster to save the precise location of an html dom node into a variable in js, or to use getElementById everytime you need to access the node? I want to make my application...
7
by: Daz | last post by:
Hi everyone! Is it possible to take a line of text like so: <tr><td>title1</td><td>title2</td><td>title3</td><td>title4</td></tr> And append it to a DOM node such as this: var...
1
by: X l e c t r i c | last post by:
webtv versions prior to 2.9 do not recognize document.getElementById, so we have to use a conditional that includes document.all. I've been trying to use a variable for document.all and...
7
by: joecap5 | last post by:
I have a main window from which I want to open a separate side menu window. I then want to create a list of items on that side menu by clicking on the item names in the main window. So far I am...
1
by: irixdude | last post by:
I am trying to create a script to enter the values of an array into a dynamically generated table 3 columns wide. I have a counter for the row # that I am using to name/id the row TR node so I an...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.