Forum Moderators: open
Because my (cgi page) don't have the option to keep the search query in the search result template page I need your help.
Here is an example with AutoTrader.co.uk
When you click this link you go to the result page which keep the search query - in this link we search for - ALFA ROMEO 145 BETWEEN 1000 AND 5000 AND POST CODE IS w13 0np
[atsearch.autotrader.co.uk...]
########################################
For now I can do it using javascript like here:
[bodytouch.co.uk...]
with text field - as you can see the result template parse the word "Sydney" in the search box.
I REALLY NEED YOUR HELP GUYS, I WANT TO FIND A WAY TO DO THE FIRST EXAMPLE - WITH NOT ONLY TEXT FIELD BUT - DROPDOWN, CHECKBOX...ETC.
Thanks a lot.
[domain.com...]
<script_on_search.html>
//Put the URI into a JS variable
thisuri=top.location.href;
//Split the URI to create a two-index array (0,1)
keywd=thisuri.split("keyword=");
//Grab the value of the keyword parameter
keyword_value=keywd[1];
</script>
This puts the keyword value into the keyword_value variable for use in text form elements and/or to print on screen. To manipulate drop-down form elements, the value you need is the index of the element within the drop-down array.
If you are using a longer URI, you may need more split()s:
[domain.com...]
Needs a script similar to:
<script_on_search.html>
//Put the URI into a JS variable
thisuri=top.location.href;
//Split the URI to create a two-index array (0,1)
keywdA=thisuri.split("keyword=");
//Split the second index to get the keyword
keywd=keywdA[1].split("&");
//Grab the value of the keyword parameter
keyword_value=keywd[0];
</script>
In the second example, the array index you want is now the FIRST index in the SECOND array, instead of being the SECOND index in the FIRST array...which it is in the first example.
BTW: You definitely can NOT count on users having Javascript enabled. The same approach could be used with server-side scripting (PHP, ASP, etc.), however it is much more simple, because you just grab the value of the attribute directly instead of needing to split the URI string.
About "Javascript enabled" the secont language I just can't see people who don't have it how they can look at the web sites - when every website - every page have javascript inside.
For example they can't see a site like "Ebay" because they don't have javascript enabled browser?