How to create Hash object/array using jquery?
Posted
by Patrick
on Stack Overflow
See other posts from Stack Overflow
or by Patrick
Published on 2010-06-09T14:56:08Z
Indexed on
2010/06/09
15:12 UTC
Read the original article
Hit count: 221
Hi folks
I know there is a Hash() object in the Javascript prototype framework, but is there anything in Jquery like this?
As I would like to stick with one javascript framework, rather than mixing the Prototype Frame work and the JQuery framework and use at the same time, as I worry there will be conflict and create side-effects.
So my question is: how to create Hash object/array using jquery?
Here is my function:
/* prototype framework, I want to change this to jQuery! */
var starSaves = new Hash();
function myHover(id, pos)
{
var starStrip = $('star_strip_' + id);
if (starSaves.keys().indexOf(id) == -1)
{
var starSave = new Array();
var imgs = starStrip.select("img")
alert(imgs);
for (var i = 0; i < imgs.length; i++)
{
starSave[starSave.length] = imgs[i].src;
if (i < pos)
imgs[i].src = "/images/star_1.gif";
else
imgs[i].src = "/images/star_0.gif";
}
starSaves.set(id, starSave);
}
}
© Stack Overflow or respective owner