Hi, I am trying to play with all the methods in the Array Object. Just wanted to check with you guys if this is the correct explanation of toQueryParams(). If yes, then I''ll add it to the documentation as well. Works for me (but I am not sure if it''s the correct way to use it). /* String.prototype.toQueryParams takes a query string, i.e, string with name value pairs separated with ''&'', splits them up and returns an object using whose properties we can get the values of the params */ /* Usage: var queryString = "?name=mandy&email=mandiv-/E1597aS9LQAvxtiuMwx3w@public.gmane.org&age=20"; name = queryString.toQueryParams().name; email= queryString.toQueryParams().email; age = queryString.toQueryParams().age; alert(name+" "+email+" "+age); */ toQueryParams: function() { var pairs = this.match(/^\??(.*)$/)[1].split(''&''); return pairs.inject({}, function(params, pairString) { var pair = pairString.split(''=''); params[pair[0]] = pair[1]; return params; }); }, Thank you, Mandy.
first of all, hi! you''ve got reaaaly nice scripts here and i''m having fun just mixing and matching one with another! well then here''s the situation. i tried to use a div''s on mouse over and mouse out to call blind down and blind up effect respectively inside cells in a table. works fine AND beautifully until the cursor got shaken then all hell breaks lose. i know we''re not supposed to do blind up/down on tables but they were applied on divs inside cells. some divs got rendered only partially when i try to hover on ones affected by the "shaking". is this a bug or a mistake on my part? if so how am i supposed to do the effect im thinking of? thanks in advance! :D __________________________________ Start your day with Yahoo! - Make it your home page! http://www.yahoo.com/r/hs
* Maninder, Singh <mandiv-W2hqgAdRMsX2eFz/2MeuCQ@public.gmane.org> [2005-10-27 02:46]:> Hi, I am trying to play with all the methods in the Array Object. > > Just wanted to check with you guys if this is the correct explanation of toQueryParams(). > If yes, then I''ll add it to the documentation as well. > > Works for me (but I am not sure if it''s the correct way to use it). > > /* String.prototype.toQueryParams takes a query string, i.e, string with > name value pairs separated with ''&'', splits them up and returns an object > using whose properties we can get the values of the params */ > /* Usage: > var queryString = "?name=mandy&email=mandiv-/E1597aS9LQAvxtiuMwx3w@public.gmane.org&age=20"; > name = queryString.toQueryParams().name; > email= queryString.toQueryParams().email; > age = queryString.toQueryParams().age; > alert(name+" "+email+" "+age); > */Since the query string is calcluated, I think a better usage would be: var str = "?name=mandy&email=mandiv-/E1597aS9LQAvxtiuMwx3w@public.gmane.org&age=20" var qs = str.toQuerySTring(); alert(qs.name + " " + qs.email + " " + qs.ag); -- Alan Gutierrez - alan-JbsJTiZCByIAvxtiuMwx3w@public.gmane.org - http://engrm.com/blogometer/
Thanks for replying and clearing my doubt Alan. -Mandy. ============================================== Since the query string is calcluated, I think a better usage would be: var str = "?name=mandy&email=mandiv-/E1597aS9LQAvxtiuMwx3w@public.gmane.org&age=20" var qs = str.toQuerySTring(); alert(qs.name + " " + qs.email + " " + qs.ag); -- Alan Gutierrez - alan-JbsJTiZCByIAvxtiuMwx3w@public.gmane.org - http://engrm.com/blogometer/ ===============================================