bitOfArray.split(".gif")
doesn't change the value of 'bitOfArray', at least as far as I can tell. I take it you want to extract cheese or whatever the filename is without its extension. This worked here in FF, Opera, and IE:
Code:
<script type="text/javascript">
myArray = new Array();
myArray[0] = "cheese.gif";
myArray[1] = "another";
bitOfArray = myArray[0].split(".gif");
bitOfArray.length--
alert(bitOfArray);
</script>
Notes: This does not change the value of myArray[0]. You can test this by changing the alert to:
Code:
alert('bit='+bitOfArray+' myArrayZero='+myArray[0]);
The line 'bitOfArray.length--' simply removes a comma (,) from the end of the string that the split method inserts.
Bookmarks