A question concearning the following code
//-- code::
<script>
function tango(){
var weaponArray = new Array(8);
var a = box1.value;
weaponArray[0] = "Item 1", value = <!-- m --><a class="postlink" href="http://www.webdeveloper.com/forum/archive/index.php/1;">http://www.webdeveloper.com/forum/archive/index.php/1;</a><!-- m -->
weaponArray[1] = "Item 2", value = 2;
weaponArray[2] = "Item 3", value = 3;
weaponArray[3] = "Item 4", value = 4;
weaponArray[4] = "Item 5", value = 5;
weaponArray[5] = "Item 6", value = "jup";
alert(" current value = "+ value + "");
if(document.all){ ouch.length++; ouch[ouch.length-1].innerText = weaponArray[a]}; return false
}
</script>
<a href="javascript:void(0)" onclick="tango();">Add</a>
<a href="javascript:void(0)" onclick="if(document.all){ if(ouch.length>0){ ouch.length--;}}; return false">Delete</a>
for a somekinda mistake I made the alert message will always give me " current value = jup" no matter which one I add (even a value out of array it will still give me jup!) though what I mean to get is when I add a 1 or a 2 *as value) this should be relatively item 1 and item 2, what do I do wrong?
If there is another way of adding an option (option with a value!) to a list/menu?
please help is welcome! (prefeable anwser in mickymouse style so I am sure to get the point)
//-- code::
<script>
function tango(){
var weaponArray = new Array(8);
var a = box1.value;
weaponArray[0] = "Item 1", value = <!-- m --><a class="postlink" href="http://www.webdeveloper.com/forum/archive/index.php/1;">http://www.webdeveloper.com/forum/archive/index.php/1;</a><!-- m -->
weaponArray[1] = "Item 2", value = 2;
weaponArray[2] = "Item 3", value = 3;
weaponArray[3] = "Item 4", value = 4;
weaponArray[4] = "Item 5", value = 5;
weaponArray[5] = "Item 6", value = "jup";
alert(" current value = "+ value + "");
if(document.all){ ouch.length++; ouch[ouch.length-1].innerText = weaponArray[a]}; return false
}
</script>
<a href="javascript:void(0)" onclick="tango();">Add</a>
<a href="javascript:void(0)" onclick="if(document.all){ if(ouch.length>0){ ouch.length--;}}; return false">Delete</a>
for a somekinda mistake I made the alert message will always give me " current value = jup" no matter which one I add (even a value out of array it will still give me jup!) though what I mean to get is when I add a 1 or a 2 *as value) this should be relatively item 1 and item 2, what do I do wrong?
If there is another way of adding an option (option with a value!) to a list/menu?
please help is welcome! (prefeable anwser in mickymouse style so I am sure to get the point)