Weirfire
Jun 11th 2007, 7:30 am
Can anyone see what the error is in the code below? My Javascript skills only stretch so far.
<script type='text/javascript'>
function explodeArray(item,delimiter) {
tempArray=new Array(1);
var Count=0;
var tempString=new String(item);
while (tempString.indexof(delimiter)>0) {
tempArray[Count]=tempString.substr(0,tempString.indexof(delimiter));
tempString=tempString.substr(tempString.indexof(delimiter)+1,tempString.length-tempString.indexof(delimiter)+1);
Count=Count+1
}
tempArray[Count]=tempString;
return tempArray;
}
function get_filename(full_path) {
parts = explodeArray(full_path,'/');
var num_items = parts.length;
return parts[(num_items-1)];
}
</script>
<script type='text/javascript'>
function explodeArray(item,delimiter) {
tempArray=new Array(1);
var Count=0;
var tempString=new String(item);
while (tempString.indexof(delimiter)>0) {
tempArray[Count]=tempString.substr(0,tempString.indexof(delimiter));
tempString=tempString.substr(tempString.indexof(delimiter)+1,tempString.length-tempString.indexof(delimiter)+1);
Count=Count+1
}
tempArray[Count]=tempString;
return tempArray;
}
function get_filename(full_path) {
parts = explodeArray(full_path,'/');
var num_items = parts.length;
return parts[(num_items-1)];
}
</script>