Сообщение от dolu
|
Вопрос: как это сделать?
|
var dictionary = new ActiveXObject("Scripting.Dictionary"), //WScript
array = ['some1', 'some2', 'some3'], //items
i = 10; //count
while(i--) {
if(array[i] != undefined) {
dictionary.Add(i, array[i]);
}
}
var j = dictionary.Count, result = [];
while(j--) {
if(dictionary.Exists(j)) {
result.unshift((dictionary.Item(j)));
}
}
WScript.echo(result);
Чтобы посмотреть в IE:
if (window.ActiveXObject) {
var dictionary = new ActiveXObject("Scripting.Dictionary"), array = ['some1', 'some2', 'some3'], i = 10;
while(i--) {
if(array[i] != undefined) {
dictionary.Add(i, array[i]);
}
}
var j = dictionary.Count, result = [];
while(j--) {
if(dictionary.Exists(j)) {
result.unshift((dictionary.Item(j)));
}
}
alert(result.join(', '));
}
else {
alert('This browser does not support ActiveXObject');
}