Page 1 of 1

location.search

Posted: Mon Sep 27, 2004 4:38 am
by newmember
i use this line in my js script:

location.search = location.search + "?cs=1"

but this doesn't work...i used alert() to print location.search before and after and it doesn't change... :?

so can i use this line or location.search is read-only ?

P.S.
also question about match() function.... i found out it return array of 3 element. first cell is the matched string, end other two cells contains first and last chracters of matched string...
Is this function supposed to return an array?? none of the examples/references i saw, mention that match() return array

Posted: Mon Sep 27, 2004 4:59 am
by kettle_drum
If it works by placing the result in a new var...then place it in a new var.

Posted: Mon Sep 27, 2004 5:17 am
by newmember
i need to save result in location.search.
i want to use it for saving state of menu (which part are closed/hidden and which opened/visible) when i browse away of the page...

Posted: Mon Sep 27, 2004 10:24 am
by feyd
yes, I believe location.search is read only. you can alter location.href to actually change the location though.

you can save the state of the menu in your php scripts by storing it into a session variable. It's a lot easier, and safer because Javascript could easily be off.

Posted: Mon Sep 27, 2004 2:52 pm
by newmember
this site:
http://www.w3schools.com/htmldom/dom_obj_location.asp
says about "location.search":
Sets or returns the part of the href property that follows the question mark (?)